SNN2.src.model.layers.distanceLayer module

class SNN2.src.model.layers.distanceLayer.ContrastiveDistance(*args, **kwargs)

Bases: Layer

call(x, y)
class SNN2.src.model.layers.distanceLayer.distance(*args, **kwargs)

Bases: Layer

DistanceLayer. This layer is responsible for computing the distance between the anchor embedding and the positive embedding, and the anchor embedding and the negative embedding.

call(positive, anchor, negative)
class SNN2.src.model.layers.distanceLayer.mahalanobis_distance(*args, **kwargs)

Bases: Layer

Mahalanobis distance layer. This layer should be used in order to calculate distances using the mahalanobis formula.

call(positive, anchor, negative)
compute_inv_cov_matrix(data: Tensor) Tuple[Tensor, Tensor]
two_samples_mahalanobis(x: Tensor, y: Tensor, cov: Tensor)