| 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); |