The elements can appear in any order (and number).
Constant element
[constant-name][type]?:[scalar, tensor on literal form, or file: followed by a file reference]
Name
Description
name
The name of the constant, written either the full feature name constant(myName), or just as name.
type
The type of the constant, either double or a tensor type.
If omitted, the type is double.
value
A number, a tensor on literal form,
or file: followed by a path relative to the model file to a
file containing the constant.
The file must be stored on the tensor JSON Format
and end with .json. The file may be lz4 compressed, in which case the ending must be
.json.lz4.
This file must be saved as example.model somewhere in the
models directory tree,
and the same directory must also contain myLargeConstant.json.lz4 with a tensor as compressed json.
model example {# All inputs that are not scalar (aka 0-dimensional tensor) must be declaredinputs{
input1 tensor(name{},x[3])
input2 tensor(x[3])
}constants{constant(constant1) tensor(x[3]):{{x:0}:0.5,{x:1}:1.5,{x:2}:2.5}constant(constant2):3.0constant(myLargeConstant) tensor(x[10000]):file:myLargeConstant.json.lz4}functionfoo1(){expression:reduce(sum(input1*input2,name)*constant1,max,x)*constant2}functionfoo2(){expression:reduce(sum(input1*input2,name)*constant(constant1asLarge),max,x)*constant2}}
This makes the model example available with the functions foo1 and foo2.