box_embeddings.modules.intersection.gumbel_intersection

Module Contents

gumbel_intersection(left: box_embeddings.parameterizations.TBoxTensor, right: box_embeddings.parameterizations.TBoxTensor, intersection_temperature: float = 1.0, approximation_mode: Optional[str] = None) box_embeddings.parameterizations.TBoxTensor

Hard Intersection operation as a function.

Note

This function can give flipped boxes, i.e. where z[i] > Z[i]

Parameters
  • left – BoxTensor which is the left operand

  • right – BoxTensor which is the right operand

  • intersection_temperature – gumbel’s beta parameter

  • approximation_mode – Use hard clipping (‘clipping’) or hard clipping with separate value for forward and backward passes (‘clipping_forward’) to satisfy the required inequalities. Set None to not use any approximation. (default: None)

Returns

The resulting BoxTensor obtained by interaction. It has the same concrete type as the self (left operand).

Raises

ValueError – When intersection_temperature is 0 or approximation_mode is not in [None, ‘clipping’, ‘clipping_forward’]

class GumbelIntersection(intersection_temperature: float = 1.0, approximation_mode: Optional[str] = None)

Bases: box_embeddings.modules.intersection._intersection._Intersection

Gumbel intersection operation as a Layer/Module.

Performs the intersection operation as described in Improving Local Identifiability in Probabilistic Box Embeddings .