ONNX Runtime JavaScript API
    Preparing search index...

    Interface GpuBufferConstructorParameters<T>

    represent the parameter for constructing a tensor from a WebGPU buffer

    interface GpuBufferConstructorParameters<
        T extends GpuBufferDataTypes = GpuBufferDataTypes,
    > {
        dims: readonly number[];
        gpuBuffer: GpuBufferTypeFallback;
        location: "gpu-buffer";
        type: T;
        dispose?(): void;
        download?(): Promise<DataTypeMap[T]>;
    }

    Type Parameters

    Hierarchy

    • CommonConstructorParameters<T>
    • GpuResourceConstructorParameters<T>
      • GpuBufferConstructorParameters
    Index

    Properties

    dims: readonly number[]

    Get the dimensions of the tensor.

    Specify the WebGPU buffer that holds the tensor data.

    location: "gpu-buffer"

    Specify the location of the data to be 'gpu-buffer'.

    type: T

    Specify the data type of the tensor.

    Methods

    • an optional callback function that will be called when the tensor is disposed.

      If not provided, the tensor treat the GPU data as external resource.

      Returns void

    • an optional callback function to download data from GPU to CPU.

      If not provided, the tensor treat the GPU data as external resource.

      Returns Promise<DataTypeMap[T]>