torch.Tensor.TensorInternals
export type TensorInternals = {
_is_leaf: boolean;
_grad_fn: GradFn | null;
_requires_grad: boolean;
_shape: Shape;
_ownsBuffer: boolean;
_reduceBroadcastGrad: (grad: Tensor) => Tensor;
_grad: Tensor | null;
_retains_grad: boolean;
_hooks: Map<number, (grad: Tensor) => Tensor | null | void>;
_post_accumulate_hooks: Map<number, (tensor: Tensor) => void>;
};A multi-dimensional array with GPU acceleration.
The type parameters enable compile-time shape and dtype checking:
const a = torch.zeros(2, 3); // Tensor<[2, 3], 'float32'>
const b = torch.zeros(2, 3, { dtype: 'int32' }); // Tensor<[2, 3], 'int32'>
const c = a.matmul(b); // Compile error: dtype mismatch