-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Closed
Description
pytorch version: '0.1.12_2'
Run this snippet (The required serialised tensor has been included in the attachment.
import torch
from torch.autograd import Variable
from torch import nn
torch.manual_seed(0)
x_restored = Variable(torch.load('x.pth'), requires_grad=False)
x_res_repeated = x_restored.repeat(10, 1)
class Network(nn.Module):
def __init__(self, dim_in, dim_out):
super(Network, self).__init__()
self.m = nn.Sequential(
nn.Linear(dim_in, 100),
nn.BatchNorm1d(100),
nn.ReLU(),
nn.Linear(100, 100),
nn.BatchNorm1d(100),
nn.ReLU(),
nn.Linear(100, dim_out*2)
)
def forward(self, X):
return self.m(X)
net = Network(x_restored.size()[1], 2)
print(net(x_restored))
print(net(x_res_repeated))
The output
Variable containing:
1.00000e-02 *
-0.5704 -3.7342 -3.6541 7.4486
[torch.FloatTensor of size 1x4]
Variable containing:
1.00000e-02 *
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.5703 -3.7480 -3.6610 7.4439
-0.4867 -3.7301 -3.6103 7.4878
-0.4867 -3.7301 -3.6103 7.4878
[torch.FloatTensor of size 10x4]
Metadata
Metadata
Assignees
Labels
No labels