BroadCasted¶
-
namespace
ndarray
-
namespace
broadcast
¶ Functions
-
ndarray::Shape
getBroadCastedShape
(const ndarray::Shape &l_shape, const ndarray::Shape &r_shape, const int offset = 0)¶ make expected broadcasted shape of two given array
Example: l_shape {4,1}, r_shape{1,3} => out_shape{4,3}
- Return
Operation output shape.
- Parameters
l_shape
: Left array shape.r_shape
: Right array shape.offset
: int value
-
BroadCastedProperty
getBroadCastedProperty
(const ndarray::Shape &out_shape, const ndarray::Array &A, const ndarray::Array &B, const int offset = 0)¶ Calculate broadcasted operated array shape and stride. Which is needed for calculate actual index of operation data.
- Return
BroadCastedProperty DTO class which have a_shape, b_shape, a_stride, b_stride.
- Parameters
out_shape
: broadcasted output shape.A
: ndarray.B
: ndarray.
-
std::vector<int>
paddedVector
(const std::vector<int> &vec, const size_t size, const int pad_value = 0)¶ make a vector fill with pad value
Example: vec{3,2,4}, size = 5, pad_value = 100 =>out_vec{100,100,3,2,4}
- Return
vector with padded value
- Parameters
vec
: int type vector.size
: expected vector size.pad_value
: expected value to fill. default: 0
-
ndarray::Shape
-
namespace