1 /** 2 * Copyright 2020 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_CORE_OPS_MAT_MUL_H_ 18 #define MINDSPORE_CORE_OPS_MAT_MUL_H_ 19 #include <vector> 20 #include <memory> 21 22 #include "ops/primitive_c.h" 23 #include "ops/op_utils.h" 24 #include "abstract/abstract_value.h" 25 #include "abstract/dshape.h" 26 #include "utils/check_convert_utils.h" 27 28 namespace mindspore { 29 namespace ops { 30 constexpr auto kNameMatMul = "MatMul"; 31 /// \brief Multiplies matrix a and matrix b. Refer to Python API @ref mindspore.ops.MatMul for more details. 32 class MS_CORE_API MatMul : public PrimitiveC { 33 public: 34 /// \brief Constructor. MatMul()35 MatMul() : PrimitiveC(kNameMatMul) { InitIOName({"x1", "x2"}, {"output"}); } 36 /// \brief Destructor. 37 ~MatMul() = default; 38 MS_DECLARE_PARENT(MatMul, PrimitiveC); 39 /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.MatMul for the inputs. 40 void Init(bool transpose_a = false, bool transpose_b = false); 41 /// \brief Set transpose_a. 42 void set_transpose_a(bool transpose_a); 43 /// \brief Set transpose_b. 44 void set_transpose_b(bool transpose_b); 45 /// \brief Get transpose_a. 46 /// 47 /// \return transpose_a. 48 bool get_transpose_a() const; 49 /// \brief Get transpose_b. 50 /// 51 /// \return transpose_b. 52 bool get_transpose_b() const; 53 }; 54 using PrimMatMulPtr = std::shared_ptr<MatMul>; 55 } // namespace ops 56 } // namespace mindspore 57 #endif // MINDSPORE_CORE_OPS_MAT_MUL_H_ 58