24 #ifndef TVM_RUNTIME_CONTAINER_SHAPE_TUPLE_H_ 25 #define TVM_RUNTIME_CONTAINER_SHAPE_TUPLE_H_ 46 static constexpr
const char*
_type_key =
"runtime.ShapeTuple";
69 explicit FromStd(std::vector<index_type> other) : data_container{other} {}
73 std::vector<index_type> data_container;
97 template <
typename IterType>
136 ICHECK(idx < this->
size()) <<
"IndexError: indexing " << idx <<
" on an array of size " 138 return this->
data()[idx];
167 auto ptr = make_object<ShapeTupleObj::FromStd>(std::move(shape));
168 ptr->size = ptr->data_container.size();
169 ptr->data = ptr->data_container.data();
170 data_ = std::move(ptr);
180 #endif // TVM_RUNTIME_CONTAINER_SHAPE_TUPLE_H_ ShapeTuple(std::initializer_list< index_type > shape)
constructor from initializer list
Definition: shape_tuple.h:104
size_t size() const
Return the size of the shape tuple.
Definition: shape_tuple.h:128
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
FromStd(std::vector< index_type > other)
Construct a new FromStd object.
Definition: shape_tuple.h:69
index_type back() const
Definition: shape_tuple.h:155
Definition: loop_state.h:456
Base utilities for common POD(plain old data) container types.
base class of all object containers.
Definition: object.h:167
index_type * data
The pointer to shape tuple data.
Definition: shape_tuple.h:41
index_type at(size_t idx) const
Immutably read i-th element from the shape tuple.
Definition: shape_tuple.h:146
static constexpr const uint32_t _type_index
Definition: shape_tuple.h:45
ShapeTuple(IterType begin, IterType end)
Constructor from iterator.
Definition: shape_tuple.h:98
const index_type * begin() const
Definition: shape_tuple.h:158
bool empty() const
Definition: shape_tuple.h:149
Tensor shape(const Tensor &src, DataType dtype, const std::string name="T_shape", const std::string tag=kInjective)
Get the shape of input tensor.
Definition: transform.h:1768
An object representing a shape tuple.
Definition: shape_tuple.h:36
runtime::ShapeTuple.
Definition: object.h:72
Base class of all object reference.
Definition: object.h:511
An object representing shape tuple moved from std::vector.
Definition: shape_tuple.h:57
const index_type * end() const
Definition: shape_tuple.h:161
uint64_t size
The size of the shape tuple object.
Definition: shape_tuple.h:43
const index_type * data() const
Return the data pointer.
Definition: shape_tuple.h:121
ShapeTupleObj::index_type index_type
The type of shape index element.
Definition: shape_tuple.h:60
ShapeTupleObj::index_type index_type
The type of shape index element.
Definition: shape_tuple.h:84
ShapeTuple()
Construct an empty shape tuple.
Definition: shape_tuple.h:89
index_type operator[](size_t idx) const
Immutably read i-th element from the shape tuple.
Definition: shape_tuple.h:135
index_type front() const
Definition: shape_tuple.h:152
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:728
friend class ShapeTuple
Definition: shape_tuple.h:51
static constexpr const char * _type_key
Definition: shape_tuple.h:46
TVM_DECLARE_FINAL_OBJECT_INFO(ShapeTupleObj, Object)
int64_t index_type
The type of shape index element.
Definition: shape_tuple.h:39
Reference to shape tuple objects.
Definition: shape_tuple.h:81