featureInputLayer — Create a feature input layer object.
featureInputLayer(numFeatures, Name, Value, ...) records a positive feature count and name-value properties. In RunMat mode, a vector of positive dimensions is also retained as layer metadata.
Syntax
layer = featureInputLayer(inputSize, Name, Value)Inputs
size- Type
SizeArg- Required
- Yes
- Description
- Positive integer scalar or, for input layers, vector of positive integers.
Name, Value- Type
Any- Required
- Variadic
- Description
- Paired, layer-specific recognized property names and values; duplicate names are invalid.
Returns
layer- Type
Any- Description
- Host layer metadata object with the named runtime class.
Errors
RunMat:deepLearning:InvalidInput- When
- A required layer size, numeric alpha, or name-value option is invalid, or more than one output is requested.
- Message
deep learning layer received invalid input
Layer metadata
MATLAB documents a scalar feature count. RunMat mode also accepts a vector InputSize as metadata; MATLAB compatibility mode rejects that extension. The current dlnetwork forward path supports only a scalar feature width and rejects vector metadata rather than ignoring trailing dimensions. No tensor is allocated by construction.
The result is a host layer object. Optional name-value arguments may be omitted to use defaults. Name and Description are text. Recognized name-value options are stored under their canonical property names; unknown, duplicate, and cross-layer option names are rejected. A layer graph can retain recognized options that are not yet executable by forward or training.
Placement and validation
The constructor validates required sizes and option syntax before downloading resident controls. Numeric and logical controls needed for validation may be gathered; data, learnables, recurrent state, and initializer captures retain their original storage and provider ownership. The result is a host metadata object, not a GPU kernel invocation. Invalid host text options reject without downloading earlier resident values. Execution validates parameter geometry and provider support separately.
Structural sizes are stored in double-valued layer properties. Typed integer sizes must survive that conversion exactly: the exact uint64 value 9,007,199,254,740,993 is rejected, while an aligned exactly representable larger integer remains admissible if it fits the host size range. This boundary does not imply that a network with that many units can be allocated.
Example
Create and inspect a layer
layer = featureInputLayer(4, 'Name', 'features'); fprintf('%g\n', layer.InputSize);Expected output:
4Using featureInputLayer with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how featureInputLayer changes the result.
Run a small featureInputLayer example, explain the result, then change one input and compare the output.
FAQ
Does constructing the layer run a model or GPU kernel?⌄
No. This call creates a host layer object; model execution is a separate operation.
Are all recognized layer options implemented by forward?⌄
No. Constructor acceptance records canonical options but does not establish an executable network form. Pending operational options require separate execution admission.
Related Deep Learning functions
adamupdate · analyzeNetwork · bilstmLayer · classificationLayer · combvec · convolution1dLayer · crossentropy · dlarray · dlarray.minus · dlarray.mtimes · dlarray.plus · dlarray.rdivide · dlarray.sum · dlarray.times · dlfeval · dlgradient · dlnetwork · dlupdate · eluLayer · exportONNXNetwork · forward · fullyConnectedLayer · get.Learnables · get.State · globalAveragePooling1dLayer · layerGraph · layerNormalizationLayer · lstmLayer · padsequences · regressionLayer · reluLayer · sequenceInputLayer · set.Learnables · set.State · softmaxLayer · trainingOptions · trainnet · trainNetwork
Source you can read
Every RunMat function's source is public. Read exactly how featureInputLayer is executed, line by line, in Rust.
- View the source for featureInputLayer in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.