sacmehta/EdgeNets

Had an error about multiplying Bool with ByteTensor

mitalbert opened this issue · 4 comments

The training script would stop throwing an error about multiplying Bool with ByteTensor in segmentation_miou.py at

        pred = pred * (target>0)
        inter = pred * (pred == target)

I assume the authors were expecting torch to cast Bool values into 0 and 1, which didn't happen.
I changed it to

        pred = pred * (target>0).type(torch.ByteTensor)
        inter = pred * .type(torch.ByteTensor)

to explicitly cast the values.

I'm not sure why this happened in my case, perhaps due to version incompatibility.

This is due to version incompatibility. Could you please share your PyTorch version so that we can debug more? Thanks

Sure, PyTorch '1.2.0'. I wonder why they committed this useful functionality.

There are some more issues in v1.2. I would recommend to use v1.1.

Thanks and agreed, had few issues after upgrading.