* Return a copied Uint8Array of the raw bytes in the Tensor. * @returns The result array.
()
| 669 | * @returns The result array. |
| 670 | */ |
| 671 | toRawBytes(): Uint8Array { |
| 672 | if (this.device.deviceType != DeviceStrToEnum.cpu) { |
| 673 | throw new Error("Can only sync copy CPU array, use cpu_arr.copyfrom(gpu_arr) then sync instead."); |
| 674 | } |
| 675 | return this.ctx.tensorCopyToJSBytes(this) as Uint8Array; |
| 676 | } |
| 677 | |
| 678 | /** |
| 679 | * Return a TypedArray copy of the Tensor, the specific type depends on |