sacmehta / EdgeNets

This repository contains the source code of our work on designing efficient CNNs for computer vision
MIT License
411 stars 82 forks source link

Had an error about multiplying Bool with ByteTensor #13

Closed mitalbert closed 5 years ago

mitalbert commented 5 years ago

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.

sacmehta commented 5 years ago

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

mitalbert commented 5 years ago

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

sacmehta commented 5 years ago

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

mitalbert commented 5 years ago

Thanks and agreed, had few issues after upgrading.