Now that PyTorch 1.5 introduced the __torch_function__ magic method that is called when torch functions are called with Tensor-likes, we can wrap around PyTorch much cleaner.
This branch removes the earlier monkey patching design in favour of this __torch_function__ design. Quick tests show that this design works very well. One caveat is in creating Distributions using storch Tensors. The broadcast_all method does not support Tensor-likes, and requires monkey patching either that method or torch.is_tensor.
Now that PyTorch 1.5 introduced the
__torch_function__
magic method that is called when torch functions are called with Tensor-likes, we can wrap around PyTorch much cleaner.This branch removes the earlier monkey patching design in favour of this
__torch_function__
design. Quick tests show that this design works very well. One caveat is in creating Distributions using storch Tensors. Thebroadcast_all
method does not support Tensor-likes, and requires monkey patching either that method ortorch.is_tensor
.Closes #59.