box_embeddings.parameterizations.tf_tanh_box_tensor
¶
Implementation of Tanh box parameterization.
Module Contents¶
- class TFTanhBoxTensor(data: Union[tensorflow.Tensor, Tuple[tensorflow.Tensor, tensorflow.Tensor]])¶
Bases:
box_embeddings.parameterizations.tf_box_tensor.TFBoxTensor
Tanh Activated Box Tensor
- property z(self) tensorflow.Tensor ¶
Lower left coordinate as Tensor
- Returns
lower left corner
- Return type
Tensor
- property Z(self) tensorflow.Tensor ¶
Top right coordinate as Tensor
- Returns
top right corner
- Return type
Tensor
- classmethod W(cls: Type[box_embeddings.parameterizations.tf_box_tensor.TFTBoxTensor], z: tensorflow.Tensor, Z: tensorflow.Tensor, *args: Any, **kwargs: Any) tensorflow.Tensor ¶
Given (z,Z), it returns one set of valid box weights W, such that Box(W) = (z,Z).
- Parameters
z – Lower left coordinate of shape (…, hidden_dims)
Z – Top right coordinate of shape (…, hidden_dims)
*args – extra arguments for child class
**kwargs – extra arguments for child class
- Returns
- Parameters of the box. In base class implementation, this
will have shape (…, 2, hidden_dims).
- Return type
Tensor
- classmethod from_vector(cls: Type[box_embeddings.parameterizations.tf_box_tensor.TFTBoxTensor], vector: tensorflow.Tensor, *args: Any, **kwargs: Any) box_embeddings.parameterizations.tf_box_tensor.TFBoxTensor ¶
Creates a box for a vector. In this base implementation the vector is split into two pieces and these are used as box weights.
- Parameters
vector – tensor
*args – extra arguments for child class
**kwargs – extra arguments for child class
- Returns
A BoxTensor
- Raises
ValueError – if last dimension is not even