Networks are declared by adding a
@network annotation to a function
For example, the following declares a network
myNetwork which takes
a 2-dimension tensor of size 28 x 28 and returns a vector of 10 rationals:
@network myNetwork : Tensor Rat [28, 28] -> Vector Rat 10
Note that although no implementation for the network is provided directly in the
myNetwork can still be used in the specification as any other
declared function would be.
This follows the Vehicle philosophy that specifications should independent of any particular network, and should be able to be used to train/test/verify a range of candidate networks implementations.
An implementation of a given network in the specification is passed in at
compile time via the
--network command line option.
For example, you can provide a concrete implementation
myNetwork by passing
At the moment only the ONNX format is supported by Vehicle. There are various libraries to convert trained models to the ONNX format:
If you would be interested in other formats being supported, please get in touch.
At the moment Vehicle supports networks with a single input and output node.
Therefore all declarations annoated with
@network must have a type of the
Tensor Rat dims1 -> Tensor Rat dims2 where
are a non-empty list of constants.
Although we are aware that common network representations such as ONNX, Tensorflow, and Pytorch can have multiple input and output nodes, these are not currently supported by Vehicle.
This is a matter of implementation rather than a fundamental limitation. Please get in touch if you would be interested in this functionality being added to Vehicle.
The following are not currently allowed:
-- Reason: boolean inputs are not current allowed -- Justification: lack of support for verifiers or training methods @network myNetwork : Tensor Bool  -> Tensor Rat