MCPcopy
hub / github.com/tensorflow/tfjs / makeTensorInfo

Method makeTensorInfo

tfjs-backend-cpu/src/backend_cpu.ts:79–94  ·  view source on GitHub ↗

* Create a data bucket in cpu backend. * @param shape Shape of the `TensorInfo`. * @param dtype DType of the `TensorInfo`. * @param values The value of the `TensorInfo` stored as a flattened array.

(
      shape: number[], dtype: DataType,
      values?: backend_util.BackendValues|string[])

Source from the content-addressed store, hash-verified

77 * @param values The value of the `TensorInfo` stored as a flattened array.
78 */
79 makeTensorInfo(
80 shape: number[], dtype: DataType,
81 values?: backend_util.BackendValues|string[]): TensorInfo {
82 let outId;
83 if (dtype === 'string' && values != null && values.length > 0 &&
84 util.isString(values[0])) {
85 const encodedValues =
86 (values as unknown as string[]).map(d => util.encodeString(d));
87
88 outId = this.write(encodedValues, shape, dtype);
89 } else {
90 outId = this.write(values as TypedArray, shape, dtype);
91 }
92
93 return {dataId: outId, shape, dtype};
94 }
95
96 /** Return refCount of a `TensorData`. */
97 override refCount(dataId: DataId): number {

Callers 15

makeOutputMethod · 0.95
zerosFunction · 0.45
binaryKernelFuncFunction · 0.45
unaryKernelFuncFromImplFunction · 0.45
fftBatchFunction · 0.45
fftImplFunction · 0.45
fftRadix2Function · 0.45
selectFunction · 0.45
transformFunction · 0.45
allFunction · 0.45
anyFunction · 0.45
resizeBilinearFunction · 0.45

Calls 1

writeMethod · 0.95

Tested by

no test coverage detected