tfl.pwl_calibration_lib.linear_initializer

View source on GitHub

Initializes PWL calibration layer to represent linear function.

PWL calibration layer weights have shape (num_keypoints, units). First row represents bias. All remaining represent delta in y-value compare to previous point. Aka heights of segments.

shape Requested shape. Must be (num_keypoints, units).
output_min Minimum value of PWL calibration output after initialization.
output_max Maximum value of PWL calibration output after initialization.
monotonicity If one of {0, 1}, the returned function will go from (input_min, output_min) to (input_max, output_max). If set to -1, 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).
dtype dtype.

PWLCalibration layer weights initialized according to params.

ValueError If given parameters are inconsistent.