ttnn.hardtanh
- ttnn.hardtanh(input_tensor: ttnn.Tensor, low, high, *, memory_config: ttnn.MemoryConfig | None = None) ttnn.Tensor
-
Applies hardtanh to
input_tensorelement-wise.\[\begin{split}hardtanh(\\mathrm{input\\_tensor}_i)\end{split}\]- Args:
-
input_tensorlowhigh
- Keyword Args:
-
memory_config(Optional[ttnn.MemoryConfig]): Memory configuration for the operation.
Example:
>>> tensor = ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16), device=device) >>> output = ttnn.hardtanh(tensor)