Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

nsl.configs.DistanceConfig

View source on GitHub

Class DistanceConfig

DistanceConfig contains configs for computing distances.

Attributes:

  • distance_type: type of distance function. Input type will be converted to 'DistanceType' when applicable (e.g., 'l2' -> DistanceType.L2). Default set to L2 norm.
  • reduction: type of distance reduction. See tf.compat.v1.losses.Reduction for details. Default set to tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS.
  • sum_over_axis: the distance is the sum over the difference along the axis. Default set to None.
  • transform_fn: type of transform function to be applied on each side before computing the pairwise distance. Input type will be converted to 'TransformType' when applicable (e.g., 'softmax' -> TransformType.SOFTMAX). Default set to 'none'.

__init__

__init__(
    distance_type=nsl.configs.DistanceType.L2,
    reduction=attr_dict['reduction'].default,
    sum_over_axis=attr_dict['sum_over_axis'].default,
    transform_fn=attr_dict['transform_fn'].default
)

Initialize self. See help(type(self)) for accurate signature.

Methods

__eq__

__eq__(other)

Return self==value.

__ge__

__ge__(other)

Automatically created by attrs.

__gt__

__gt__(other)

Automatically created by attrs.

__le__

__le__(other)

Automatically created by attrs.

__lt__

__lt__(other)

Automatically created by attrs.

__ne__

__ne__(other)

Check equality and either forward a NotImplemented or return the result negated.