(t: TensorInfo)
| 144 | } |
| 145 | |
| 146 | bufferSync<R extends Rank, D extends DataType>(t: TensorInfo): |
| 147 | TensorBuffer<R, D> { |
| 148 | const data = this.readSync(t.dataId); |
| 149 | if (t.dtype === 'string') { |
| 150 | try { |
| 151 | // Decode the bytes into string. |
| 152 | const strings = (data as Uint8Array[]).map(d => util.decodeString(d)); |
| 153 | return buffer(t.shape as ShapeMap[R], t.dtype, strings) as |
| 154 | TensorBuffer<R, D>; |
| 155 | } catch { |
| 156 | throw new Error('Failed to decode encoded string bytes into utf-8'); |
| 157 | } |
| 158 | } |
| 159 | return buffer(t.shape as ShapeMap[R], t.dtype, data as TypedArray) as |
| 160 | TensorBuffer<R, D>; |
| 161 | } |
| 162 | |
| 163 | makeOutput<T extends Tensor>( |
| 164 | values: backend_util.BackendValues, shape: number[], dtype: DataType): T { |
no test coverage detected