(array: Union[Array, Tensor], dtype=torch.float32)
| 94 | |
| 95 | |
| 96 | def to_tensor(array: Union[Array, Tensor], dtype=torch.float32) -> Tensor: |
| 97 | if torch.is_tensor(array): |
| 98 | return array |
| 99 | else: |
| 100 | return torch.tensor(array, dtype=dtype) |
| 101 | |
| 102 | |
| 103 | class Struct(object): |