Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfl.pwl_calibration_layer.UniformOutputInitializer

View source on GitHub

Initializes PWL calibration layer to represent linear function.

tfl.pwl_calibration_layer.UniformOutputInitializer(
    output_min, output_max, monotonicity, keypoints=None
)

PWL calibration layer weights are one-d tensor. First element of tensor represents bias. All remaining represent delta in y-value compare to previous point. Aka heights of segments.

Args:

  • output_min: Minimum value of PWL calibration output after initialization.
  • output_max: Maximum value of PWL calibration output after initialization.
  • monotonicity: - if 'none' or 'increasing', the returned function will go from (input_min, output_min) to (input_max, output_max).
    • if 'decreasing', the returned function will go from (input_min, output_max) to (input_max, output_min).
  • keypoints: - if not provided (None or []), all pieces of returned function will have equal heights (i.e. y[i+1] - y[i] is constant).
    • if provided, all pieces of returned function will have equal slopes (i.e. (y[i+1] - y[i]) / (x[i+1] - x[i]) is constant).

Methods

__call__

View source

__call__(
    shape, dtype=None, partition_info=None
)

Returns weights of PWL calibration layer.

Args:

  • shape: Must be rank-2 tensor with of shape (k, units) where k >= 2.
  • dtype: Standard Keras initializer param.
  • partition_info: Standard Keras initializer param.

Returns:

Weights of PWL calibration layer.

Raises:

  • ValueError: If requested shape is invalid for PWL calibration layer weights.

from_config

@classmethod
from_config(
    cls, config
)

Instantiates an initializer from a configuration dictionary.

Example:

initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)

Args:

  • config: A Python dictionary. It will typically be the output of get_config.

Returns:

An Initializer instance.

get_config

View source

get_config()

Standard Keras config for serialization.