pytorch-simple-gan
pytorch-simple-gan copied to clipboard
ValueError: Using a target size (torch.Size([16])) that is different to the input size (torch.Size([16, 1])) is deprecated. Please ensure they have the same size.
I'm getting the following error when trying to execute train.py
ValueError Traceback (most recent call last)
/usr/local/lib/python3.9/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs) 887 result = self._slow_forward(*input, **kwargs) 888 else: --> 889 result = self.forward(*input, **kwargs) 890 for hook in itertools.chain( 891 _global_forward_hooks.values(),
/usr/local/lib/python3.9/site-packages/torch/nn/modules/loss.py in forward(self, input, target) 611 def forward(self, input: Tensor, target: Tensor) -> Tensor: 612 assert self.weight is None or isinstance(self.weight, Tensor) --> 613 return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction) 614 615
/usr/local/lib/python3.9/site-packages/torch/nn/functional.py in binary_cross_entropy(input, target, weight, size_average, reduce, reduction) 2748 reduction_enum = _Reduction.get_enum(reduction) 2749 if target.size() != input.size(): -> 2750 raise ValueError( 2751 "Using a target size ({}) that is different to the input size ({}) is deprecated. " 2752 "Please ensure they have the same size.".format(target.size(), input.size())
ValueError: Using a target size (torch.Size([16])) that is different to the input size (torch.Size([16, 1])) is deprecated. Please ensure they have the same size.
[-]
I got this error as well
Hello! I have fixed this error in the following patch. https://github.com/CAPTAIN320/pytorch-simple-gan/tree/CAPTAIN320-patch