MCPcopy Index your code
hub / github.com/tensorflow/tfjs / tensorToBinding

Method tensorToBinding

tfjs-backend-webgpu/src/backend_webgpu.ts:715–731  ·  view source on GitHub ↗
(tensor?: TensorInfo)

Source from the content-addressed store, hash-verified

713 }
714
715 private tensorToBinding(tensor?: TensorInfo): GPUBindingResource {
716 if (!tensor) {
717 return null;
718 }
719
720 const tensorData = this.tensorMap.get(tensor.dataId);
721 const resource = tensorData.resource;
722
723 if (resource instanceof GPUBuffer) {
724 return {buffer: resource};
725 }
726 if (resource instanceof GPUTexture) {
727 return resource.createView();
728 }
729 // GPUExternalTexture
730 return resource;
731 }
732
733 uploadToGPU(dataId: DataId): void {
734 const tensorData = this.tensorMap.get(dataId);

Callers 1

recordAndSubmitMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected