Class Shape#
Defined in File shape.h
Inheritance Relationships#
Base Type#
public tvm::ffi::ObjectRef
(Class ObjectRef)
Class Documentation#
-
class Shape : public tvm::ffi::ObjectRef#
Managed reference to shape object.
When possible, use ShapeView instead of Shape to reduce memory allocation. Use Shape when you need to have a managed reference to on-heap allocated shape.
See also
Public Types
-
using index_type = ShapeObj::index_type#
The type of shape index element.
Public Functions
-
inline Shape()#
Default constructor.
-
template<typename IterType>
inline Shape(IterType begin, IterType end)# Constructor from iterator.
- Parameters:
begin – begin of iterator
end – end of iterator
- Template Parameters:
IterType – The type of iterator
-
inline Shape(Array<int64_t> shape)#
Constructor from Array<int64_t>
Note
This constructor will copy the data content.
- Parameters:
shape – The Array<int64_t>
-
inline Shape(std::initializer_list<int64_t> shape)#
constructor from initializer list
- Parameters:
shape – The initializer list
-
inline Shape(std::vector<int64_t> other)#
constructor from int64_t [N]
- Parameters:
other – a int64_t array.
-
inline const int64_t *data() const#
Return the data pointer.
- Returns:
const index_type* data pointer
-
inline size_t size() const#
Return the size of the shape tuple.
- Returns:
size_t shape tuple size
-
inline int64_t at(size_t idx) const#
Immutably read i-th element from the shape tuple.
- Parameters:
idx – The index
- Returns:
the i-th element.
-
inline bool empty() const#
- Returns:
Whether shape tuple is empty
-
inline int64_t front() const#
- Returns:
The first element of the shape tuple
-
inline int64_t back() const#
- Returns:
The last element of the shape tuple
-
inline const int64_t *begin() const#
- Returns:
begin iterator
-
inline const int64_t *end() const#
- Returns:
end iterator
-
inline int64_t Product() const#
- Returns:
The product of the shape tuple
-
using index_type = ShapeObj::index_type#