View source on GitHub |
Contains configuration for computing distances between tensors.
nsl.configs.DistanceConfig(
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
)
Attributes | |
---|---|
distance_type
|
type of distance function. Input type will be converted to
the appropriate nsl.configs.DistanceType value (e.g., the value 'l2' is
converted to nsl.configs.DistanceType.L2 ). Defaults to the L2 norm.
|
reduction
|
type of distance reduction. See 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 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 when applicable (e.g., the value 'softmax'
maps to nsl.configs.TransformType.SOFTMAX ). Defaults to 'none'.
|
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
)
Method generated by attrs for class DistanceConfig.