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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-02 UTC."],[],[]]