Join us virtually at the Women in ML Symposium on October 19

# tfl.lattice_lib.linear_initializer

Returns a lattice layer weight tensor that represents a linear function.

• The linear function will have positive coefficients for monotonic dimensions and 0 otherwise. If all dimensions are unconstrained, all coefficients will be positive.
• Linear coefficients are set such that the minimum/maximum output of the lattice matches the given output_min/output_max.
• Each monotonic dimension contributes with same weight regardless of number of vertices per dimension.
• No dimension can be both monotonic and unimodal.
• Unimodal dimensions contribute with same weight as monotonic dimensions.
• Unimodal dimensions linearly decrease for first `(dim_size + 1) // 2` vertices and then linearly increase for following vertices.

`lattice_sizes` List or tuple of integers which represents lattice sizes.
`output_min` Minimum output of lattice layer after initialization.
`output_max` Maximum output of lattice layer after initialization.
`monotonicities` None or list or tuple of same length as lattice_sizes of {0, 1} which represents monotonicity constraints per dimension. 1 stands for increasing (non-decreasing in fact), 0 for no monotonicity constraints.
`unimodalities` None or list or tuple of same length as lattice_sizes of {-1, 0, 1} which represents unimodality constraints per dimension. 1 indicates that function first decreases then increases, -1 indicates that function first increases then decreases, 0 indicates no unimodality constraints.
`units` Output dimension of the layer. Each of units lattices will be initialized identically.
`dtype` dtype.

Lattice weights tensor of shape: `(prod(lattice_sizes), units)`.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]