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

Function Input

tfjs-layers/src/engine/input_layer.ts:175–208  ·  view source on GitHub ↗
(config: InputConfig)

Source from the content-addressed store, hash-verified

173}
174
175export function Input(config: InputConfig): SymbolicTensor {
176 if (config.batchShape == null && config.shape == null) {
177 throw new Error(
178 'Please provide to Input either a `shape`' +
179 ' or a `batchShape` argument. Note that ' +
180 '`shape` does not include the batch ' +
181 'dimension.');
182 }
183 if (config.batchShape != null && config.shape != null) {
184 // TODO(michaelterry): Backport to PyKeras.
185 throw new ValueError(
186 'Please provide either a `shape` or `batchShape` ' +
187 'argument to Input, but not both.');
188 }
189 let batchShape = config.batchShape;
190 if (config.shape != null && batchShape == null) {
191 batchShape = [null].concat(config.shape);
192 }
193
194 let dtype = config.dtype;
195 if (dtype == null) {
196 dtype = 'float32';
197 }
198
199 const inputLayer = new InputLayer({
200 batchInputShape: batchShape,
201 name: config.name,
202 dtype,
203 sparse: config.sparse
204 });
205
206 const outputs = inputLayer.inboundNodes[0].outputTensors;
207 return outputs[0];
208}

Callers 3

addMethod · 0.90
inputFunction · 0.90

Calls 1

concatMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…