Closed TomMelt closed 4 months ago
@TomMelt First glance looks good.
However, we'll need any examples in the documentation and readme also updating if you can go through these as well please?
done
@TomMelt Thanks - I wonder if an addition to the API changes page to point out this new option might be useful, though not essential as the old function is preserved?
Also I added a comment above with an edit for your thoughts:
I also wonder if your original suggestion of having an interface to delete both an array or a single tensor is a better to simplify the subroutine options. However, I also see that the explicitness of two different routines is more 'Fortranic'.
A new thought on looking at some code today - perhaps we could have an interface torch_delete()
that can take a model, tensor, or array of tensors and call the relevant deletion subroutine?
This PR adds a subroutine (
torch_tensor_array_delete
) to delete arrays of tensors. This eliminate the need to manually loop over all elements of the array callingtorch_tensor_delete
, see e.g.,https://github.com/Cambridge-ICCS/FTorch/blob/490272ef5662936be26697d496b14f6a281214fa/examples/4_MultiIO/multiionet_infer_fortran.f90#L57-L60
Which now becomes,
https://github.com/Cambridge-ICCS/FTorch/blob/e24c38024e0ec8b03ecd0f8a3e6c269e42ac2a0c/examples/4_MultiIO/multiionet_infer_fortran.f90#L57-L58
torch_tensor_array_delete
to delete arrays of tensors