1 /** 2 * Copyright 2019-2023 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 PARALLEL_AUTO_PARALLEL_REC_TENSOR_H_ 18 #define PARALLEL_AUTO_PARALLEL_REC_TENSOR_H_ 19 20 #include <cstdint> 21 #include "frontend/parallel/auto_parallel/rec_core/rec_strategy.h" 22 23 namespace mindspore { 24 namespace parallel { 25 enum TensorType { kInt8, kFloat16, kFloat32, kDouble64 }; 26 27 struct Shape4D { 28 int64_t shape_n = 1; 29 int64_t shape_c = 1; 30 int64_t shape_h = 1; 31 int64_t shape_w = 1; 32 33 bool operator==(const Shape4D sh) const { 34 if (shape_n == sh.shape_n && shape_c == sh.shape_c && shape_h == sh.shape_h && shape_w == sh.shape_w) { 35 return true; 36 } 37 return false; 38 } 39 }; 40 41 struct TensorParam { 42 TensorType tensor_type = kFloat32; // default as float. 43 Shape4D tensor_shape; 44 TensorStr4D tensor_str; 45 }; 46 } // namespace parallel 47 } // namespace mindspore 48 49 #endif // PARALLEL_AUTO_PARALLEL_REC_TENSOR_H_ 50