Open abidhasan03 opened 1 year ago
The issue says that the F.binary_cross_entropy_with_logits does not work on TensorImage and also it will not work on TensorMask. So, you need to change those to torch tensors to make them work. You can wrap them with TensorBase() and you are good to go.
loss_func = nn.BCEWithLogitsLoss()
loss = loss_func(activs, Tensor(y))
loss
In the Chapter 6 notebook: 06_multicat.ipynb, The binary cross entropy calculation using either the nn module or F function gives "TypeError"
Executing this cell,
Gives,
TypeError: no implementation found for 'torch.nn.functional.binary_cross_entropy_with_logits' on types that implement __torch_function__: [<class 'fastai.torch_core.TensorImage'>, <class 'fastai.torch_core.TensorMultiCategory'>]
Furthermore, trying to calculate the same loss using function seems to run into the same problem too.
TypeError: no implementation found for 'torch.nn.functional.binary_cross_entropy_with_logits' on types that implement __torch_function__: [<class 'fastai.torch_core.TensorImage'>, <class 'fastai.torch_core.TensorMultiCategory'>]
The issue persisted in both CPU and GPU runtime.