FTorch
FTorch copied to clipboard
Overload binary elementary operations to accept Fortran arrays
I had a brainwave: if we overload each binary elementary operation (+, -, *, /) so that it can accept a tensor and a Fortran array then we can apply torch_tensor_from_array to the Fortran array inside the operator and then output the tensor from the existing overloads. By doing so, it won't be necessary for users to rewrite their downstream code using tensors. All we need is the tensor that comes out of the network and then we can set things up so that anything that interacts with it outputs a tensor, thereby tracking the gradient.