<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/neural-structured-learning/blob/v1.4.0/neural_structured_learning/configs/configs.py#L196-L218) |

Contains configuration for computing distances between tensors.

    nsl.configs.DistanceConfig(
        distance_type=https://www.tensorflow.org/neural_structured_learning/api_docs/python/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
    )

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `distance_type` | type of distance function. Input type will be converted to the appropriate [`nsl.configs.DistanceType`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/DistanceType) value (e.g., the value 'l2' is converted to [`nsl.configs.DistanceType.L2`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/DistanceType#L2)). Defaults to the L2 norm. |
| `reduction` | type of distance reduction. See [`tf.compat.v1.losses.Reduction`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/losses/Reduction) for details. Defaults to `tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS`. |
| `sum_over_axis` | the distance is the sum over the difference along the axis. See [`nsl.lib.pairwise_distance_wrapper`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/lib/pairwise_distance_wrapper) for how this field is used. Defaults 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 [`nsl.configs.TransformType`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/TransformType) when applicable (e.g., the value 'softmax' maps to [`nsl.configs.TransformType.SOFTMAX`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/TransformType#SOFTMAX)). Defaults to 'none'. |

<br />

## Methods

### `__eq__`

    __eq__(
        other
    )

Method generated by attrs for class DistanceConfig.

### `__ge__`

    __ge__(
        other
    )

Method generated by attrs for class DistanceConfig.

### `__gt__`

    __gt__(
        other
    )

Method generated by attrs for class DistanceConfig.

### `__le__`

    __le__(
        other
    )

Method generated by attrs for class DistanceConfig.

### `__lt__`

    __lt__(
        other
    )

Method generated by attrs for class DistanceConfig.

### `__ne__`

    __ne__(
        other
    )

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