FTorch icon indicating copy to clipboard operation
FTorch copied to clipboard

Implement `torch_tensor_to_array`

Open joewallwork opened this issue 1 year ago • 2 comments

Closes #151.

Implements torch_to_blob on the C++ side and torch_tensor_to_array on the Fortran side.

Updates example 1 to use this.

joewallwork avatar Jul 22 '24 17:07 joewallwork

I have a question about the update to example 1 - presumably the use of torch_tensor_to_array is redundant here if you had not also changed the out_data to pointer?

Agreed. I was planning to switch this to torch_tensor_empty, but this hasn't been implemented yet.

My feeling is that this adds additional layers of confusion and is not what this example is intended to show as people's first entry point to FTorch. Perhaps there could be a separate example for introducing the autograd features?

Yeah, fair enough. Perhaps this PR could start the autograd demo as just "to tensor" and then "to array".

joewallwork avatar Jul 23 '24 08:07 joewallwork

This is now ready for review, with thanks to @TomMelt for input on the C++ side.

joewallwork avatar Jul 23 '24 11:07 joewallwork