Skip to content

model() gives error in the vnet training #4

@mauliknshah

Description

@mauliknshah

Parameters Initialized.
Process Started with Seed, 100
VNET Config.

  • Number of params: 65191134
    loading training set
    loading test set
    Setting Class Weights
    Setting the Optimization Algorithm.
    1

ValueError Traceback (most recent call last)
in ()
1 if name == 'main':
----> 2 main()

in main()
168 #Set Optimization parameters.
169 adjust_opt(opt_algo, optimizer, epoch)
--> 170 train_nll(is_cuda, epoch, model, trainLoader, optimizer, trainF, class_weights)
171 err = test_nll(is_cuda, epoch, model, testLoader, optimizer, testF, class_weights)
172 is_best = False

in train_nll(is_cuda, epoch, model, trainLoader, optimizer, trainF, weights)
9 data, target = Variable(data), Variable(target)
10 optimizer.zero_grad()
---> 11 output = model(data)
12 target = target.view(target.numel())
13 loss = F.nll_loss(output, target, weight=weights)

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)

~/anaconda3/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py in forward(self, *inputs, **kwargs)
66 def forward(self, *inputs, **kwargs):
67 if not self.device_ids:
---> 68 return self.module(*inputs, **kwargs)
69 inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)
70 if len(self.device_ids) == 1:

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)

~/localgit/brainchild/brainchild/vnet.py in forward(self, x)
208
209 def forward(self, x):
--> 210 out16 = self.in_tr(x)
211 out32 = self.down_tr32(out16)
212 out64 = self.down_tr64(out32)

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)

~/localgit/brainchild/brainchild/vnet.py in forward(self, x)
83 def forward(self, x):
84 # do we want a PRELU here as well?
---> 85 out = self.bn1(self.conv1(x))
86 # split input in to 16 channels
87 x16 = torch.cat((x, x, x, x, x, x, x, x,

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/conv.py in forward(self, input)
386 def forward(self, input):
387 return F.conv3d(input, self.weight, self.bias, self.stride,
--> 388 self.padding, self.dilation, self.groups)
389
390

~/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py in conv3d(input, weight, bias, stride, padding, dilation, groups)
119
120 if input is not None and input.dim() != 5:
--> 121 raise ValueError("Expected 5D tensor as input, got {}D tensor instead.".format(input.dim()))
122
123 f = _ConvNd(_triple(stride), _triple(padding), _triple(dilation), False,

ValueError: Expected 5D tensor as input, got 4D tensor instead.

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions