Struct Shape¶
Defined in File shape.h
Struct Documentation¶
-
struct
Shape
¶ Shape class mainly defines the shape or dimensionality of the node.
Basically, Shape is a wrapper of a std::vector. Its size is the number of dimension. E.g., shape={2,3} means 2D matrix with dim[0]=2 and dim[1]=3. WHen the index is negative, the real index is size() + index. It implements most common functions demanded by operations, e.g., resize(), slice(), and broadcast().
Public Functions
-
Shape
()¶
-
size_t
size
() const¶
-
void
resize
(size_t n)¶
-
const int *
data
() const¶
-
int *
data
()¶
-
void
set
(int i, int val)¶
-
void
set
(size_t i, int val)¶
-
void
set
(int i, size_t val)¶
-
void
set
(size_t i, size_t val)¶
-
int &
dim
(int i)¶
-
const int &
dim
(int i) const¶
-
int &
dim
(size_t i)¶
-
const int &
dim
(size_t i) const¶
-
int
operator[]
(int i) const¶
-
int
operator[]
(int i)¶
-
int
operator[]
(size_t i) const¶
-
int
operator[]
(size_t i)¶
-
int
back
() const¶
-
int &
back
()¶
-
int
stride
(int i) const¶
-
auto
begin
()¶
-
auto
begin
() const¶
-
auto
end
()¶
-
auto
end
() const¶
-
auto
rbegin
()¶
-
auto
rbegin
() const¶
-
auto
rend
()¶
-
auto
rend
() const¶
-
bool
operator==
(const Shape &other) const
-
bool
operator!=
(const Shape &other) const
-
operator std::string
() const¶
-
int
axis
(int ax) const¶
-
size_t
hash
() const¶
Public Static Functions
Friends
-
std::ostream &
operator<<
(std::ostream &strm, const Shape &shape)¶
-