Program Listing for File tensor.h

Return to documentation for file (include/converter/include/mindapi/ir/tensor.h)

#ifndef MINDSPORE_CORE_MINDAPI_IR_TENSOR_H_
#define MINDSPORE_CORE_MINDAPI_IR_TENSOR_H_

#include <cstdint>
#include "mindapi/base/base.h"
#include "mindapi/base/shape_vector.h"
#include "mindapi/base/type_id.h"
#include "mindapi/ir/common.h"
#include "mindapi/ir/value.h"

namespace mindspore::api {
class MIND_API Tensor : public Value {
 public:
  MIND_API_BASE_MEMBER(Tensor);

  Tensor(TypeId data_type, const ShapeVector &shape);

  Tensor(TypeId data_type, const ShapeVector &shape, void *data, size_t data_len);

  const ShapeVector &shape() const;

  void set_shape(const ShapeVector &shape);

  TypeId data_type() const;

  void set_data_type(const TypeId data_type);

  const void *data() const;

  void *data();

  size_t DataSize() const;

  std::size_t Size() const;
};

using TensorPtr = SharedPtr<Tensor>;
}  // namespace mindspore::api
#endif  // MINDSPORE_CORE_MINDAPI_IR_TENSOR_H_