TensorFlow 2.0 RC is available Learn more

tft.scale_by_min_max_per_key

tft.scale_by_min_max_per_key(
    x,
    key=None,
    output_min=0.0,
    output_max=1.0,
    elementwise=False,
    name=None
)

Scale a numerical column into a predefined range on a per-key basis.

Args:

  • x: A numeric Tensor or SparseTensor.
  • key: A Tensor or SparseTensor of dtype tf.string. Must meet one of the following conditions:
    1. key is None
    2. Both x and key are dense,
    3. Both x and key are sparse and key must exactly match x in everything except values,
    4. The axis=1 index of each x matches its index of dense key.
  • output_min: The minimum of the range of output values.
  • output_max: The maximum of the range of output values.
  • elementwise: If true, scale each element of the tensor independently.
  • name: (Optional) A name for this operation.

Returns:

A Tensor or SparseTensor containing the input column scaled to [output_min, output_max] on a per-key basis if a key is provided.

Raises:

  • ValueError: If output_min, output_max have the wrong order.
  • NotImplementedError: If elementwise is True and key is not None.
  • InvalidArgumentError: If indices of sparse x and key do not match.