ttnn.lerp
- ttnn.lerp(input: ttnn.Tensor, end: ttnn.Tensor, weight: ttnn.Tensor or float, *, memory_config: ttnn.MemoryConfig | None = None) None
-
Computes Lerp on
input
,end
andweight
and returns the tensor with the same layout asinput
\[\mathrm{output\_tensor} = \verb|lerp|(\mathrm{input, end, weight})\]- Parameters:
-
input (ttnn.Tensor) – the input tensor with the starting points.
end (ttnn.Tensor) – the tensor with the ending points.
weight (ttnn.Tensor or float) – the weight for the interpolation formula.
- Keyword Arguments:
-
memory_config (ttnn.MemoryConfig, optional) – memory configuration for the operation. Defaults to None.
Note
Supported dtypes, layouts, and ranks:
Dtypes
Layouts
Ranks
BFLOAT16, BFLOAT8_B
TILE
2, 3, 4
bfloat8_b/bfloat4_b supports only on TILE_LAYOUT
end, weight tensors should have same dtype as input
Example
>>> tensor1 = ttnn.from_torch(torch.tensor([[1, 0], [1, 0]], dtype=torch.bfloat16), layout=ttnn.TILE_LAYOUT, device=device) >>> tensor2 = ttnn.from_torch(torch.tensor([[1, 2], [3, 4]], dtype=torch.bfloat16), layout=ttnn.TILE_LAYOUT, device=device) >>> tensor3 = ttnn.from_torch(torch.tensor([[1, 2], [3, 4]], dtype=torch.bfloat16), layout=ttnn.TILE_LAYOUT, device=device) >>> output = ttnn.lerp(tensor1, tensor2, tensor3/scalar)