diff --git a/tests/tt_eager/python_api_testing/unit_testing/test_moreh_matmul.py b/tests/tt_eager/python_api_testing/unit_testing/test_moreh_matmul.py index 1b95f3db1e0..eff0c1ee756 100644 --- a/tests/tt_eager/python_api_testing/unit_testing/test_moreh_matmul.py +++ b/tests/tt_eager/python_api_testing/unit_testing/test_moreh_matmul.py @@ -312,7 +312,7 @@ def test_primary_moreh_matmul(params, device): cpu_layout = ttl.tensor.Layout.ROW_MAJOR tt_output = ( ttl.operations.primary.moreh_matmul( - tt_input, tt_other, transpose_input=transpose_input, transpose_other=transpose_other + tt_input, tt_other, transpose_input_a=transpose_input, transpose_input_b=transpose_other ) .cpu() .to(cpu_layout) diff --git a/tt_eager/tt_lib/csrc/operations/primary/module.hpp b/tt_eager/tt_lib/csrc/operations/primary/module.hpp index 39ef4361c9f..9625db2314d 100644 --- a/tt_eager/tt_lib/csrc/operations/primary/module.hpp +++ b/tt_eager/tt_lib/csrc/operations/primary/module.hpp @@ -343,12 +343,12 @@ void py_module(py::module& m_primary) { m_primary.def( "moreh_matmul", &moreh_matmul, - py::arg("input_tensor").noconvert(), - py::arg("other_tensor").noconvert(), + py::arg("input_a").noconvert(), + py::arg("input_b").noconvert(), py::kw_only(), py::arg("output_tensor").noconvert() = std::nullopt, - py::arg("transpose_input").noconvert() = false, - py::arg("transpose_other").noconvert() = false, + py::arg("transpose_input_a").noconvert() = false, + py::arg("transpose_input_b").noconvert() = false, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, "Performs a moreh_matmul operation."); @@ -357,10 +357,10 @@ void py_module(py::module& m_primary) { "moreh_matmul_backward", &moreh_matmul_backward, py::arg("output_grad").noconvert(), - py::arg("input").noconvert(), - py::arg("other").noconvert(), - py::arg("input_grad").noconvert() = std::nullopt, - py::arg("other_grad").noconvert() = std::nullopt, + py::arg("input_a").noconvert(), + py::arg("input_b").noconvert(), + py::arg("input_a_grad").noconvert() = std::nullopt, + py::arg("input_b_grad").noconvert() = std::nullopt, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( "Performs a moreh_matmul_backward operation. diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor.cpp index 420c95de63d..e4c0bcd3537 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor.cpp @@ -335,14 +335,14 @@ void TensorModule(py::module &m_tensor) { // moreh_linear m_tensor.def("moreh_matmul", &moreh_matmul, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( "Performs a moreh_linear operation. .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Input tensor", "Tensor", "", "Yes" - "other", "Other tensor", "Tensor", "", "Yes" + "input_a", "First input tensor", "Tensor", "", "Yes" + "input_b", "Second input tensor", "Tensor", "", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_backward_ops.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_backward_ops.cpp index 817d8168fee..a4f3d2ebc52 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_backward_ops.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_backward_ops.cpp @@ -10,8 +10,8 @@ namespace tt::tt_metal::detail{ void TensorModuleBackwardOPs( py::module & m_tensor){ m_tensor.def("addalpha_bw", &tt::tt_metal::addalpha_bw, - py::arg("grad").noconvert(), py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Performs backward operations for multiplication of ``other`` and ``alpha`` tensors with given ``grad``. + py::arg("grad").noconvert(), py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Performs backward operations for multiplication of ``input_b`` and ``alpha`` tensors with given ``grad``. Input tensor must have BFLOAT16 data type. @@ -21,8 +21,8 @@ namespace tt::tt_metal::detail{ :header: "Argument", "Description", "Data type", "Valid range", "Required" "grad", "Gradient tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "input", "Tensor addalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor addalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "alpha", "Alpha value", "float", "default to 1.0f", "No" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); @@ -165,8 +165,8 @@ namespace tt::tt_metal::detail{ )doc"); m_tensor.def("add_bw", &tt::tt_metal::add_bw, - py::arg("grad").noconvert(), py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Performs backward operations for addition of ``other`` tensors with given ``grad``. + py::arg("grad").noconvert(), py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Performs backward operations for addition of ``input_b`` tensors with given ``grad``. Input tensor must have BFLOAT16 data type. @@ -176,8 +176,8 @@ namespace tt::tt_metal::detail{ :header: "Argument", "Description", "Data type", "Valid range", "Required" "grad", "Gradient tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "input", "Tensor add is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor add is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); @@ -249,8 +249,8 @@ namespace tt::tt_metal::detail{ )doc"); m_tensor.def("div_bw", &tt::tt_metal::div_bw, - py::arg("grad").noconvert(), py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Performs backward operations for division of ``other`` with given ``grad``. + py::arg("grad").noconvert(), py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Performs backward operations for division of ``input_b`` with given ``grad``. Input tensor must have BFLOAT16 data type. @@ -260,14 +260,14 @@ namespace tt::tt_metal::detail{ :header: "Argument", "Description", "Data type", "Valid range", "Required" "grad", "Gradient tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "input", "Tensor div is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor div is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("max_bw", &tt::tt_metal::max_bw, - py::arg("grad").noconvert(), py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Performs backward operations for maximum of ``other`` with given ``grad``. + py::arg("grad").noconvert(), py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Performs backward operations for maximum of ``input_b`` with given ``grad``. Input tensor must have BFLOAT16 data type. @@ -277,15 +277,15 @@ namespace tt::tt_metal::detail{ :header: "Argument", "Description", "Data type", "Valid range", "Required" "grad", "Gradient tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "input", "Tensor max is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor max is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("where_bw", &tt::tt_metal::where_bw, - py::arg("grad").noconvert(), py::arg("condition").noconvert(), py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Performs backward operations for where selected from either ``input`` or ``other``, depending on ``condition`` with given ``grad``. + py::arg("grad").noconvert(), py::arg("condition").noconvert(), py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Performs backward operations for where selected from either ``input_a`` or ``input_b``, depending on ``condition`` with given ``grad``. When condition True (nonzero), yield grad, otherwise yield zero's. Input tensor must have BFLOAT16 data type. @@ -297,8 +297,8 @@ namespace tt::tt_metal::detail{ "grad", "Gradient tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "condition", "Tensor", "Bool", "Tensor of shape [W, Z, Y, X]", "Yes" - "input", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_composite_ops.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_composite_ops.cpp index c1b48fddb37..f1c463b8368 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_composite_ops.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_composite_ops.cpp @@ -11,29 +11,29 @@ namespace tt::tt_metal::detail{ void TensorModuleCompositeOPs( py::module & m_tensor){ m_tensor.def("repeat", &tt::tt_metal::repeat, - py::arg("input_a"), py::arg("shape"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Returns a new tensor filled with repetition of input ``input_a`` tensor according to number of times specified in ``shape``. The rank of ``shape`` should be same as rank of tensor ``input_a`` and contain positive integer entries - a limitation in our implementation. + py::arg("input"), py::arg("shape"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Returns a new tensor filled with repetition of input ``input`` tensor according to number of times specified in ``shape``. The rank of ``shape`` should be same as rank of tensor ``input_a`` and contain positive integer entries - a limitation in our implementation. Output tensor will have BFLOAT16 data type. .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input_a", "Input tensor for which repetition is computed", "Tensor", "Tensor of any shape", "Yes" + "input", "Input tensor for which repetition is computed", "Tensor", "Tensor of any shape", "Yes" "shape", "Shape value", "Shape", "The number of times to repeat this tensor along each dimension", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("power_fp", &tt::tt_metal::power_fp, - py::arg("input_a"), py::arg("exponent"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Returns a new tensor filled with power of input ``input_a`` raised to value of ``exponent``. + py::arg("input"), py::arg("exponent"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Returns a new tensor filled with power of input ``input`` raised to value of ``exponent``. Output tensor will have BFLOAT16 data type. .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input_a", "Input tensor for which power is computed", "Tensor", "Tensor of any shape", "Yes" + "input", "Input tensor for which power is computed", "Tensor", "Tensor of any shape", "Yes" "exponent", "exponent value", "float", "positive floating point value", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); @@ -56,7 +56,7 @@ namespace tt::tt_metal::detail{ m_tensor.def("outer", &outer, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( Perform a non-batched outer product multiplication ``arg0 x arg1`` with two tensors. Both input tensors must have BFLOAT16 data type but shape [1,1,N,1] and [1,1,1,M] respectively @@ -67,8 +67,8 @@ namespace tt::tt_metal::detail{ .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "First tensor to multiply", "Tensor", "Tensor of shape [1, 1, N, 1]", "Yes" - "other", "Second tensor to multiply", "Tensor", "Tensor of shape [1, 1, 1, M]", "Yes" + "input_a", "First tensor to multiply", "Tensor", "Tensor of shape [1, 1, N, 1]", "Yes" + "input_b", "Second tensor to multiply", "Tensor", "Tensor of shape [1, 1, 1, M]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); @@ -237,8 +237,8 @@ namespace tt::tt_metal::detail{ )doc"); m_tensor.def("isclose", &isclose, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("rtol") = 1e-05f, py::arg("atol") = 1e-08f, py::arg("equal_nan") = false, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Applies the isclose function to the elements of the input tensor ``input`` and ``other``. + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("rtol") = 1e-05f, py::arg("atol") = 1e-08f, py::arg("equal_nan") = false, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Applies the isclose function to the elements of the input tensor ``input_a`` and ``input_b``. Input tensor must have BFLOAT16 data type. @@ -246,13 +246,13 @@ namespace tt::tt_metal::detail{ if equal_nan True, then two NaN s will be considered equal, else not equal. - isclose(input, other, rtol, atol) = ∣input−other∣ ≤ atol+rtol×∣other∣. + isclose(input_a, input_b, rtol, atol) = ∣input_a−input_B∣ ≤ atol+rtol×∣input_b∣. .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Tensor isclose is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor isclose is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor isclose is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor isclose is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "rtol", "rtol value", "float", "default to 1e-05f", "No" "atol", "atol value", "float", "default to 1e-08f", "No" "equal_nan", "equal_nan value", "bool", "default to false", "No" @@ -330,8 +330,8 @@ namespace tt::tt_metal::detail{ )doc"); m_tensor.def("subalpha", &subalpha, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Subtracts ``other``, scaled by ``alpha``, from ``input``. + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Subtracts ``input_b``, scaled by ``alpha``, from ``input_a``. Input tensor must have BFLOAT16 data type. @@ -340,15 +340,15 @@ namespace tt::tt_metal::detail{ .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Tensor subalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor subalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "alpha", "Alpha value", "float", "default to 1.0f", "No" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("addalpha", &addalpha, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Add ``other``, scaled by ``alpha``, from ``input``. + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("alpha") = 1.0f, py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Add ``input_b``, scaled by ``alpha``, from ``input_a``. Input tensor must have BFLOAT16 data type. @@ -357,8 +357,8 @@ namespace tt::tt_metal::detail{ .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Tensor addalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" - "other", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_a", "Tensor addalpha is applied to", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" + "input_b", "Tensor", "Tensor", "Tensor of shape [W, Z, Y, X]", "Yes" "alpha", "Alpha value", "float", "default to 1.0f", "No" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); @@ -779,7 +779,7 @@ namespace tt::tt_metal::detail{ detail::bind_binary_op(m_tensor, "scatter", &tt::tt_metal::scatter, R"doc(Performs scatter operation on elements of the input tensors ``{0}`` and ``{1}``,specifically to copy channel data.)doc"); detail::bind_binary_op(m_tensor, "xlogy", &xlogy, R"doc(Performs eltwise-binary xlogy (``{0} * log( {1} )``) on two tensors.)doc"); detail::bind_binary_op(m_tensor, "atan2", &atan2, R"doc(Returns tensor with the atan2 activation on elements of the input tensors ``{0}`` and ``{1}``.)doc"); - detail::bind_binary_op(m_tensor, "nextafter", &nextafter, R"doc(Returns the next floating-point value after input towards other of the input tensors ``{0}`` and ``{1}``.)doc"); + detail::bind_binary_op(m_tensor, "nextafter", &nextafter, R"doc(Returns the next floating-point value after input_a towards input_b of the input tensors ``{0}`` and ``{1}``.)doc"); // *** type-2 complex operations in new submodule 'type2_complex' *** auto m_type2_cplx = m_tensor.def_submodule("complex", "Complex type2"); @@ -800,56 +800,56 @@ namespace tt::tt_metal::detail{ m_tensor.def("is_real", py::overload_cast(tt::tt_metal::is_real), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns boolean tensor if value of complex tensor ``{0}`` is real.)doc" ); m_tensor.def("is_imag", py::overload_cast(tt::tt_metal::is_imag), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns boolean tensor if value of complex tensor ``{0}`` is imaginary.)doc" ); m_tensor.def("complex_abs", py::overload_cast(tt::tt_metal::complex_abs), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns absolute value of complex tensor ``{0}``.)doc" ); m_tensor.def("real", py::overload_cast(tt::tt_metal::real), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns real value of complex tensor ``{0}``.)doc" ); m_tensor.def("imag", py::overload_cast(tt::tt_metal::imag), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns imaginary value of complex tensor ``{0}``.)doc" ); m_tensor.def("angle", py::overload_cast(tt::tt_metal::angle), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns angle of a complex tensor ``{0}``.)doc" ); m_tensor.def("conj", py::overload_cast(tt::tt_metal::conj), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns complex conjugate value of complex tensor ``{0}``.)doc" ); m_tensor.def("complex_recip", py::overload_cast(tt::tt_metal::complex_recip), - py::arg("input_a"), + py::arg("input"), py::arg("output_mem_config").noconvert() = std::nullopt, R"doc(Returns complex reciprocal value of complex tensor ``{0}``.)doc" ); diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_custom_bmm_ops.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_custom_bmm_ops.cpp index 5a9a51bbd0c..d001bec41df 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_custom_bmm_ops.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_custom_bmm_ops.cpp @@ -41,7 +41,7 @@ namespace tt::tt_metal::detail )doc"); // *** matrix multiplication *** m_tensor.def("matmul", &matmul, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( Perform a non-batched matrix multiplication ``arg0 x arg1`` with two tensors. Both input tensors must have BFLOAT16 data type. @@ -51,13 +51,13 @@ namespace tt::tt_metal::detail .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "First tensor to multiply", "Tensor", "Tensor of shape [1, 1, Y, S]", "Yes" - "other", "Second tensor to multiply", "Tensor", "Tensor of shape [1, 1, S, X]", "Yes" + "input_a", "First tensor to multiply", "Tensor", "Tensor of shape [1, 1, Y, S]", "Yes" + "input_b", "Second tensor to multiply", "Tensor", "Tensor of shape [1, 1, S, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("bmm", &bmm, - py::arg("input").noconvert(), py::arg("other").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( Perform a batched matmul ``arg0 x arg1`` with two tensors, where batch dims match. Both input tensors must have BFLOAT16 data type. @@ -67,8 +67,8 @@ namespace tt::tt_metal::detail .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "First tensor to multiply", "Tensor", "Tensor of shape [W, Z, Y, S]", "Yes" - "other", "Second tensor to multiply", "Tensor", "Tensor of shape [W, Z, S, X]", "Yes" + "input_a", "First tensor to multiply", "Tensor", "Tensor of shape [W, Z, Y, S]", "Yes" + "input_b", "Second tensor to multiply", "Tensor", "Tensor of shape [W, Z, S, X]", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_dm_ops.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_dm_ops.cpp index ecb06d0c720..acb0ed4bbd4 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_dm_ops.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_dm_ops.cpp @@ -260,10 +260,10 @@ namespace tt::tt_metal::detail{ // *** broadcast and reduce *** m_tensor.def("bcast", &bcast, - py::arg().noconvert(), py::arg().noconvert(), py::arg("math_op"), py::arg("dim"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Perform a binary elementwise operation ``math_op`` between tensors ``input`` and ``other``, where values from tensor ``other`` are broadcast. + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("math_op"), py::arg("dim"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Perform a binary elementwise operation ``math_op`` between tensors ``input_a`` and ``input_b``, where values from tensor ``input_b`` are broadcast. - Let tensor ``input`` have shape ``[W0, Z0, Y0, X0]`` and tensor ``other`` shape ``[W1, Z1, Y1, X1]``. ``arg3`` determines the type of broadcast performed. + Let tensor ``input_a`` have shape ``[W0, Z0, Y0, X0]`` and tensor ``input_b`` shape ``[W1, Z1, Y1, X1]``. ``dim`` determines the type of broadcast performed. For ``dim=BcastOpDim::W`` broadcast is performed on dimension ``X``. ``Y0`` and ``Y1`` must be the same and either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1). @@ -278,24 +278,24 @@ namespace tt::tt_metal::detail{ .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Input tensor", "Tensor", "Tensor of shape [W0, Z0, Y0, X0]", "Yes" - "other", "Input tensor to broadcast", "Tensor", "Tensor of shape [W1, Z1, Y1, X1]", "Yes" + "input_a", "Input tensor", "Tensor", "Tensor of shape [W0, Z0, Y0, X0]", "Yes" + "input_b", "Input tensor to broadcast", "Tensor", "Tensor of shape [W1, Z1, Y1, X1]", "Yes" "math_op", "Aggregating math operation", " BcastOpMath", "ADD, SUB, MUL", "Yes" "dim", "Dimension on which to broadcast", "BcastOpDim", "W, H, HW", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" )doc"); m_tensor.def("bcast_without_autoformat", &bcast_without_autoformat, - py::arg().noconvert(), py::arg().noconvert(), py::arg("math_op"), py::arg("dim"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( - Perform a binary elementwise operation ``arg2`` between tensors ``arg0`` and ``arg1``, where values from tensor ``arg1`` are broadcast. + py::arg("input_a").noconvert(), py::arg("input_b").noconvert(), py::arg("math_op"), py::arg("dim"), py::arg("output_mem_config").noconvert() = operation::DEFAULT_OUTPUT_MEMORY_CONFIG, R"doc( + Perform a binary elementwise operation ``math_op`` between tensors ``input_a`` and ``input_b``, where values from tensor ``input_b`` are broadcast. - Let tensor ``arg0`` have shape ``[W0, Z0, Y0, X0]`` and tensor ``arg1`` shape ``[W1, Z1, Y1, X1]``. ``arg3`` determines the type of broadcast performed. + Let tensor ``input_a`` have shape ``[W0, Z0, Y0, X0]`` and tensor ``input_b`` shape ``[W1, Z1, Y1, X1]``. ``dim`` determines the type of broadcast performed. - For ``arg3=BcastOpDim::W`` broadcast is performed on dimension ``X``. ``Y0`` and ``Y1`` must be the same and either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1). + For ``dim=BcastOpDim::W`` broadcast is performed on dimension ``X``. ``Y0`` and ``Y1`` must be the same and either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1). - For ``arg3=BcastOpDim::H`` broadcast is performed on dimension ``Y``. ``X0`` and ``X1`` must be the same and either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1). + For ``dim=BcastOpDim::H`` broadcast is performed on dimension ``Y``. ``X0`` and ``X1`` must be the same and either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1). - For ``arg3=BcastOpDim::HW`` broadcast is performed on dimensions ``X`` and ``Y``. Either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1) must hold for input shapes. + For ``dim=BcastOpDim::HW`` broadcast is performed on dimensions ``X`` and ``Y``. Either (W1=1 and Z1=1) or (W0=W1 and Z0=Z1) must hold for input shapes. Both input tensors must have BFLOAT16 data type. @@ -306,8 +306,8 @@ namespace tt::tt_metal::detail{ .. csv-table:: :header: "Argument", "Description", "Data type", "Valid range", "Required" - "input", "Input tensor", "Tensor", "Tensor of shape [W0, Z0, Y0, X0], where Y0%32=0 and X0%32=0", "Yes" - "other", "Input tensor to broadcast", "Tensor", "Tensor of shape [W1, Z1, Y1, X1], where Y1%32=0 and X1%32=0", "Yes" + "input_a", "Input tensor", "Tensor", "Tensor of shape [W0, Z0, Y0, X0], where Y0%32=0 and X0%32=0", "Yes" + "input_b", "Input tensor to broadcast", "Tensor", "Tensor of shape [W1, Z1, Y1, X1], where Y1%32=0 and X1%32=0", "Yes" "math_op", "Aggregating math operation", " BcastOpMath", "ADD, SUB, MUL", "Yes" "dim", "Dimension on which to broadcast", "BcastOpDim", "W, H, HW", "Yes" "output_mem_config", "Layout of tensor in TT Accelerator device memory banks", "MemoryConfig", "Default is interleaved in DRAM", "No" diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_impl.hpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_impl.hpp index 42f0d8144f1..3640383eccc 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_impl.hpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_impl.hpp @@ -59,7 +59,7 @@ void bind_op_with_mem_config(py::module_ &module, std::string op_name, Func &&f, template void bind_binary_op(py::module_ &module, std::string op_name, Func &&f, std::string op_desc) { - std::vector arg_name = {"input", "other"}; + std::vector arg_name = {"input_a", "input_b"}; op_desc = fmt::format(op_desc, arg_name[0], arg_name[1]); std::string docstring = fmt::format(R"doc( diff --git a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_xary_ops.cpp b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_xary_ops.cpp index 20ad12bf33c..08ab64b10a1 100644 --- a/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_xary_ops.cpp +++ b/tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_xary_ops.cpp @@ -41,7 +41,7 @@ namespace tt::tt_metal::detail { // *** eltwise unary *** detail::bind_unary_op(m_tensor, "identity", identity, R"doc(Returns a copy of same tensor ``input``; useful for profiling the SFPU. - this shouldn't normally be used; users should normally use copy operation instead for same functionality as this would be lower performance. + this shouldn't normally be used; users should normally use clone operation instead for same functionality as this would be lower performance. )doc"); detail::bind_unary_op(m_tensor, "recip", recip, R"doc(Returns a new tensor with the reciprocal of the elements of the input tensor ``recip``.)doc"); detail::bind_unary_op(m_tensor, "relu", relu, R"doc(Applies the rectified linear unit (ReLU) function to the elements of the input tensor ``{0}``.)doc");