1 /** 2 * This is the C++ adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/). 3 * 4 * Copyright 2019 Huawei Technologies Co., Ltd 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef MINDSPORE_CORE_IR_API_TENSOR_IMPL_H_ 20 #define MINDSPORE_CORE_IR_API_TENSOR_IMPL_H_ 21 22 #include <string> 23 #include <vector> 24 #include <memory> 25 #include "include/api/types.h" 26 27 namespace mindspore { 28 class MSTensor::Impl { 29 public: 30 Impl() = default; 31 virtual ~Impl() = default; 32 33 virtual const std::string &Name() const = 0; 34 virtual enum DataType DataType() const = 0; 35 virtual const std::vector<int64_t> &Shape() const = 0; 36 virtual void SetShape(const std::vector<int64_t> &shape) = 0; 37 38 virtual std::shared_ptr<const void> Data() const = 0; 39 virtual void *MutableData() = 0; 40 virtual size_t DataSize() const = 0; 41 42 virtual bool IsDevice() const = 0; 43 44 virtual std::shared_ptr<Impl> Clone() const = 0; 45 }; 46 } // namespace mindspore 47 48 #endif // MINDSPORE_CORE_IR_API_TENSOR_IMPL_H_ 49