With the current stable version of PyTorch (1.5 at time of writing), MentisOculi crashes for three reasons:
First, subtraction is used with bool tensors, resulting in the following error:
RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported. If you are trying to invert a mask, use the `~` or `logical_not()` operator instead.
Second, computing the value of is_first
in the getFirstOcc
function causes the following error to be thrown:
RuntimeError: Expected object of scalar type unsigned char but got scalar type bool for sequence element 1.
Changing the first element in the list from btype([1])
to btype([1]).bool()
fixes this problem.
Third, Writing the image to file in the save_img
function fails when using CUDA unless I explicitly copy the image to CPU using img = img.cpu
.
I have fixed all three of these problems in this pull request, and MentisOculi appears to be able to render the "ring" image correctly. (I have not tested with the Cornell box.)
Caveat: While executing, the application repeatedly prints the following deprecation warning:
../aten/src/ATen/native/IndexingUtils.h:19: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
I have not fixed this. However, it does not stop the renderer from working.