24 #ifndef TVM_RUNTIME_METADATA_H_
25 #define TVM_RUNTIME_METADATA_H_
27 #include <dmlc/memory_io.h>
39 #define TVM_METADATA_VERSION 1
57 static constexpr
const char*
_type_key =
"metadata.MetadataNode";
66 inline ::tvm::runtime::String
mod_name()
const { return ::tvm::runtime::String(data_->
mod_name); }
67 const struct ::TVMMetadata*
data()
const {
return data_; }
73 const struct ::TVMMetadata* data_;
78 explicit Metadata(
const struct ::TVMMetadata* data);
85 static constexpr
const char*
_type_key =
"metadata.TensorInfoNode";
87 inline ::tvm::runtime::String
name()
const { return ::tvm::runtime::String(data_->
name); }
89 inline ::tvm::support::Span<const int64_t, int64_t>
shape()
const {
90 return ::tvm::support::Span<const int64_t, int64_t>(data_->
shape,
94 const struct ::TVMTensorInfo*
data()
const {
return data_; }
98 const struct ::TVMTensorInfo* data_;
111 static constexpr
const char*
_type_key =
"metadata.ConstantInfoNode";
117 inline ::tvm::runtime::NDArray
data()
const {
121 ndarray.
Load(&bytes);
128 const struct ::TVMConstantInfo*
data_;
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.h:51
bool Load(dmlc::Stream *stream)
Load NDArray from stream.
Definition: ndarray.h:502
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
runtime::DataType DataType
Definition: data_type.h:493
A managed object in the TVM runtime.
Reimplementation of part of C++-20 style span.
const void * data_bytes
data bytes of serialized NDArray
Definition: metadata_types.h:102
int64_t byte_offset
Offset in bytes of the constant.
Definition: metadata_types.h:98
const char * name_hint
Name of the constant.
Definition: metadata_types.h:96
int64_t data_len
length of the data_bytes field
Definition: metadata_types.h:100
int64_t num_shape
Rank of this tensor.
Definition: metadata_types.h:85
DLDataType dtype
Data type of one element of this tensor.
Definition: metadata_types.h:87
const char * name
Name of the tensor, as specified in the Relay program.
Definition: metadata_types.h:81
const int64_t * shape
Shape of the tensor.
Definition: metadata_types.h:83