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

Method bufferSync

tfjs-backend-cpu/src/backend_cpu.ts:146–161  ·  view source on GitHub ↗
(t: TensorInfo)

Source from the content-addressed store, hash-verified

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 {

Callers 11

stridedSliceFunction · 0.45
gatherNdFunction · 0.45
denseBincountFunction · 0.45
gatherV2Function · 0.45
avgPool3DGradFunction · 0.45
scatterNdFunction · 0.45
sparseToDenseFunction · 0.45
reverseFunction · 0.45
tensorScatterUpdateFunction · 0.45
tileFunction · 0.45
maxPool3DGradFunction · 0.45

Calls 2

readSyncMethod · 0.95
bufferFunction · 0.90

Tested by

no test coverage detected