Point operations

Batch operations on points in D-dimensional Eucledian space R^D.

tensorbank.tf.points.pairwise_l1_distance(a, b)[source]

Compute pairwise L1 distance between all points in A and B.

L1 norm is sum(|x_i - y_i|)

Parameters
  • a (Tensor [N x K x D]) – point coordinates. N is batch size, K is the number of points in a batch, D is the dimension of the Euclidian space.

  • b (Tensor [N x M x D]) – point coordinates, N is batch size, M is the number of points in a batch, D is the dimension of the euclidian space.

Returns

pairwise L1 distance between each pair of points.

Return type

Tensor [N x K x M]

tensorbank.tf.points.pairwise_l2_distance(a, b, sqrt=True)[source]

Compute pairwise L2 distance between all points in A and B.

L2 norm is sqrt(sum(|x_i - y_i| ^ 2))

Parameters
  • a (Tensor [N x K x D]) – point coordinates. N is batch size, K is the number of points in a batch, D is the dimension of the Euclidian space.

  • b (Tensor [N x M x D]) – point coordinates, N is batch size, M is the number of points in a batch, D is the dimension of the euclidian space.

  • sqrt (bool, optional) – whether take the square root. Defaults to True.

Returns

pairwise L2 distance between each pair of points.

Return type

Tensor [N x K x M]

tensorbank.tf.points.pairwise_l_inf_distance(a, b)[source]

Compute pairwise L∞ distance between all points in A and B.

L-infinity is max(|x_i - y_i|)

Parameters
  • a (Tensor [N x K x D]) – point coordinates. N is batch size, K is the number of points in a batch, D is the dimension of the Euclidian space.

  • b (Tensor [N x M x D]) – point coordinates, N is batch size, M is the number of points in a batch, D is the dimension of the euclidian space.

Returns

pairwise L-infinity distance between each pair of points.

Return type

Tensor [N x K x M]