ak.to_torch#
Defined in awkward.operations.ak_to_torch on line 15.
- ak.to_torch(array)#
Converts an Awkward Array into a PyTorch Tensor, if possible.
If
arraycontains any other data types (RecordArray for example) the function raises a TypeError.- Parameters:
array – Array-like data (anything
ak.to_layoutrecognizes).- Returns:
A PyTorch tensor with the same data as
array, if the conversion is possible.