接口 GpuBufferConstructorParameters<T>

表示从 WebGPU buffer 构造张量的参数

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

类型参数

继承关系

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

属性

dims: readonly number[]

获取张量的维度。

指定包含张量数据的 WebGPU buffer。

location: "gpu-buffer"

指定数据的位置为 'gpu-buffer'。

type: T

指定张量的数据类型。

方法

  • 一个可选的回调函数,当张量被释放时将被调用。

    如果未提供,张量会将 GPU 数据视为外部资源。

    返回值 void

  • 一个可选的回调函数,用于将数据从 GPU 下载到 CPU。

    如果未提供,张量会将 GPU 数据视为外部资源。

    返回值 Promise<DataTypeMap[T]>

使用 TypeDoc 生成