tensor_clamp

class maze.distributions.utils.tensor_clamp(x: torch.Tensor, t_min: torch.Tensor, t_max: torch.Tensor)

Clamping with tensor and broadcast support.

Parameters
  • x – the tensor to clamp.

  • t_min – the minimum values.

  • t_max – the maximum values.

Returns

the clamped tensor.