• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 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_CCSRC_FRONTEND_PARALLEL_TENSOR_LAYOUT_ARRAY_H_
18 #define MINDSPORE_CCSRC_FRONTEND_PARALLEL_TENSOR_LAYOUT_ARRAY_H_
19 
20 #include <cstdint>
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 #include "frontend/parallel/status.h"
26 #include "frontend/parallel/device_matrix.h"
27 
28 namespace mindspore {
29 namespace parallel {
30 class Array {
31  public:
32   Array() = default;
33   virtual ~Array() = default;
34   std::string ToString() const;
35   virtual Status Init(const Shape &array);
36   bool IsvalidArray() const;
array()37   Shape array() const { return array_; }
GetDimSize()38   size_t GetDimSize() const { return array_.size(); }
39   int64_t GetDimByIdx(size_t idx) const;
40   int64_t GetDimByReverseIdx(size_t idx) const;
41   bool operator==(const Array &shape) const;
42 
43  protected:
44   Shape array_;
45 };
46 }  // namespace parallel
47 }  // namespace mindspore
48 
49 #endif  // MINDSPORE_CCSRC_FRONTEND_PARALLEL_TENSOR_LAYOUT_ARRAY_H_
50