tfl.lattice_lib.linear_initializer
Stay organized with collections
Save and categorize content based on your preferences.
Returns a lattice layer weight tensor that represents a linear function.
tfl.lattice_lib.linear_initializer(
lattice_sizes,
output_min,
output_max,
monotonicities=None,
unimodalities=None,
units=1,
dtype=tf.float32
)
- 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.
Args |
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.
|
Returns |
Lattice weights tensor of shape: (prod(lattice_sizes), units) .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-02 UTC.
[{
"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"
}]
{
"lastModified": "Last updated 2024-08-02 UTC.",
"confidential": False
}