MCPcopy Index your code
hub / github.com/tensorflow/tfjs / write

Method write

tfjs-backend-webgl/src/backend_webgl.ts:211–227  ·  view source on GitHub ↗
(values: BackendValues, shape: number[], dtype: DataType)

Source from the content-addressed store, hash-verified

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 {

Callers 1

makeTensorInfoMethod · 0.95

Calls 5

nextDataIdMethod · 0.95
envFunction · 0.90
getBoolMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected