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

Method getTensorInfos

tfjs-tflite/src/tflite_model_test.ts:72–122  ·  view source on GitHub ↗
(firstTensorType: TFLiteDataType = 'int32')

Source from the content-addressed store, hash-verified

70 }
71
72 private getTensorInfos(firstTensorType: TFLiteDataType = 'int32'):
73 TFLiteWebModelRunnerTensorInfo[] {
74 const shape0 = [1, 2, 3];
75 let buffer0: Int8Array|Uint8Array|Int16Array|Int32Array|Uint32Array|
76 Float32Array|Float64Array = undefined;
77 const size0 = shape0.reduce((a, c) => a * c, 1);
78 switch (firstTensorType) {
79 case 'int8':
80 buffer0 = new Int8Array(size0);
81 break;
82 case 'uint8':
83 buffer0 = new Uint8Array(size0);
84 break;
85 case 'int16':
86 buffer0 = new Int16Array(size0);
87 break;
88 case 'int32':
89 buffer0 = new Int32Array(size0);
90 break;
91 case 'uint32':
92 buffer0 = new Uint32Array(size0);
93 break;
94 case 'float32':
95 buffer0 = new Float32Array(size0);
96 break;
97 case 'float64':
98 buffer0 = new Float64Array(size0);
99 break;
100 default:
101 break;
102 }
103
104 const shape1 = [1, 2];
105 const buffer1 = new Float32Array(shape1.reduce((a, c) => a * c, 1));
106 return [
107 {
108 id: 0,
109 dataType: firstTensorType,
110 name: 't0',
111 shape: shape0.join(','),
112 data: () => buffer0,
113 },
114 {
115 id: 1,
116 dataType: 'float32',
117 name: 't1',
118 shape: shape1.join(','),
119 data: () => buffer1,
120 },
121 ];
122 }
123}
124
125let tfliteModel: TFLiteModel;

Callers 1

constructorMethod · 0.95

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected