(values: BackendValues, shape: number[], dtype: DataType)
| 209 | } |
| 210 | |
| 211 | override write(values: BackendValues, shape: number[], dtype: DataType): |
| 212 | DataId { |
| 213 | if (env().getBool('WEBGL_CHECK_NUMERICAL_PROBLEMS') || |
| 214 | env().getBool('DEBUG')) { |
| 215 | this.checkNumericalProblems(values); |
| 216 | } |
| 217 | if (dtype === 'complex64' && values != null) { |
| 218 | throw new Error( |
| 219 | `Cannot write to a complex64 dtype. ` + |
| 220 | `Please use tf.complex(real, imag).`); |
| 221 | } |
| 222 | const dataId = {id: this.nextDataId()}; |
| 223 | this.texData.set( |
| 224 | dataId, |
| 225 | {shape, dtype, values, usage: TextureUsage.UPLOAD, refCount: 1}); |
| 226 | return dataId; |
| 227 | } |
| 228 | |
| 229 | /** Return refCount of a `TensorData`. */ |
| 230 | override refCount(dataId: DataId): number { |
no test coverage detected