flambe.nn.distance.hyperbolic¶

Module Contents¶

flambe.nn.distance.hyperbolic.EPSILON = 1e-05[source]
flambe.nn.distance.hyperbolic.arccosh(x)[source]

Compute the arcosh, numerically stable.

flambe.nn.distance.hyperbolic.mdot(x, y)[source]

Compute the inner product.

flambe.nn.distance.hyperbolic.dist(x, y)[source]

Get the hyperbolic distance between x and y.

flambe.nn.distance.hyperbolic.project(x)[source]

Project onto the hyeprboloid embedded in in n+1 dimensions.

flambe.nn.distance.hyperbolic.log_map(x, y)[source]

Perform the log step.

flambe.nn.distance.hyperbolic.norm(x)[source]

Compute the norm

flambe.nn.distance.hyperbolic.exp_map(x, y)[source]

Perform the exp step.

flambe.nn.distance.hyperbolic.loss(x, y)[source]

Get the loss for the optimizer.

class flambe.nn.distance.hyperbolic.HyperbolicDistance[source]

Implement a HyperbolicDistance object.

forward(self, mat_1: Tensor, mat_2: Tensor)[source]

Returns the squared euclidean distance between each element in mat_1 and each element in mat_2.

Parameters: mat_1 (torch.Tensor) – matrix of shape (n_1, n_features) mat_2 (torch.Tensor) – matrix of shape (n_2, n_features) dist – distance matrix of shape (n_1, n_2) torch.Tensor
class flambe.nn.distance.hyperbolic.HyperbolicMean[source]

Compute the mean point in the hyperboloid model.

forward(self, data: Tensor)[source]

Performs a forward pass through the network.

Parameters: data (torch.Tensor) – The input data, as a float tensor The encoded output, as a float tensor torch.Tensor