(t: TensorInfo)
| 471 | } |
| 472 | |
| 473 | bufferSync<R extends Rank, D extends DataType>(t: TensorInfo): |
| 474 | TensorBuffer<R, D> { |
| 475 | const data = this.readSync(t.dataId); |
| 476 | if (t.dtype === 'string') { |
| 477 | try { |
| 478 | // Decode the bytes into string. |
| 479 | const strings = (data as Uint8Array[]).map(d => util.decodeString(d)); |
| 480 | return buffer(t.shape as ShapeMap[R], t.dtype, strings) as |
| 481 | TensorBuffer<R, D>; |
| 482 | } catch { |
| 483 | throw new Error('Failed to decode encoded string bytes into utf-8'); |
| 484 | } |
| 485 | } |
| 486 | return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as |
| 487 | TensorBuffer<R, D>; |
| 488 | } |
| 489 | |
| 490 | private checkNumericalProblems(values: BackendValues): void { |
| 491 | if (values == null) { |
no test coverage detected