torch.WebGPUTensorData
export interface WebGPUTensorData {
buffer: GPUBuffer;
shape: readonly number[];
dtype: DType;
device: 'webgpu';
requires_grad: boolean;
grad_fn?: GradFn;
/** If false, this tensor is a view and does not own its buffer (won't release on destroy) */
ownsBuffer?: boolean;
}buffer(GPUBuffer)shape(readonly number[])dtype(DType)device('webgpu')requires_grad(boolean)grad_fn(GradFn)optionalownsBuffer(boolean)optional- – If false, this tensor is a view and does not own its buffer (won't release on destroy)
Internal tensor data structure for WebGPU tensors.
Contains the metadata and GPU buffer reference for tensors allocated on the WebGPU device. This is the low-level representation that backs the public Tensor class.
Fields:
- buffer: GPU buffer handle (GPUBuffer from WebGPU API)
- shape: Dimensions of the tensor
- dtype: Element data type
- device: Always 'webgpu' for this variant
- requires_grad: Whether gradients are tracked for this tensor
- grad_fn: Function that computes gradients during backward pass
- ownsBuffer: Whether this tensor owns the buffer (vs borrowed/view)