/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/docs-7.0.0/include/ck_tile/host/host_tensor.hpp Source File#
host_tensor.hpp
Go to the documentation of this file.
384 explicit HostTensor(const HostTensor<FromT>& other) : HostTensor(other.template CopyAsType<T>())
Definition: span.hpp:18
__host__ constexpr __device__ auto rank([[maybe_unused]] const Layout< Shape, UnrolledDescriptorType > &layout)
Get layout rank (num elements in shape).
Definition: layout_utils.hpp:310
auto fill(OutputRange &&range, const T &init) -> std::void_t< decltype(std::fill(std::begin(std::forward< OutputRange >(range)), std::end(std::forward< OutputRange >(range)), init))>
Definition: algorithm.hpp:25
auto transform(InputRange &&range, OutputIterator iter, UnaryOperation unary_op) -> decltype(std::transform(std::begin(range), std::end(range), iter, unary_op))
Definition: algorithm.hpp:36
Definition: literals.hpp:9
Definition: cluster_descriptor.hpp:13
CK_TILE_HOST auto make_ParallelTensorFunctor(F f, Xs... xs)
Definition: host_tensor.hpp:329
CK_TILE_HOST auto call_f_unpack_args(F f, T args)
Definition: host_tensor.hpp:67
CK_TILE_HOST HostTensorDescriptor transpose_host_tensor_descriptor_given_new2old(const HostTensorDescriptor &a, const New2Old &new2old)
Definition: host_tensor.hpp:259
CK_TILE_HOST auto call_f_unpack_args_impl(F f, T args, std::index_sequence< Is... >)
Definition: host_tensor.hpp:61
auto host_tensor_descriptor(std::size_t row, std::size_t col, std::size_t stride, bool_constant< is_row_major >)
Creates a host tensor descriptor with specified dimensions and layout.
Definition: host_tensor.hpp:765
CK_TILE_HOST std::ostream & LogRangeAsType(std::ostream &os, Range &&range, std::string delim, int precision=std::cout.precision(), int width=0)
Definition: host_tensor.hpp:42
CK_TILE_HOST std::ostream & LogRange(std::ostream &os, Range &&range, std::string delim, int precision=std::cout.precision(), int width=0)
Definition: host_tensor.hpp:23
CK_TILE_HOST auto construct_f_unpack_args(F, T args)
Definition: host_tensor.hpp:81
CK_TILE_HOST auto construct_f_unpack_args_impl(T args, std::index_sequence< Is... >)
Definition: host_tensor.hpp:75
auto get_default_stride(std::size_t row, std::size_t col, std::size_t stride, bool_constant< is_row_major >)
Definition: host_tensor.hpp:783
__device__ void inner_product(const TA &a, const TB &b, TC &c)
Definition: host_tensor.hpp:101
std::size_t get_stride(std::size_t dim) const
Definition: host_tensor.hpp:200
std::size_t GetOffsetFromMultiIndex(Is... is) const
Calculates the linear offset from multi-dimensional indices.
Definition: host_tensor.hpp:217
std::size_t get_element_size() const
Calculates the total number of elements in the tensor.
Definition: host_tensor.hpp:165
void CalculateStrides()
Definition: host_tensor.hpp:105
std::size_t get_num_of_dimension() const
Definition: host_tensor.hpp:153
HostTensorDescriptor(const std::initializer_list< X > &lens, const std::initializer_list< Y > &strides)
Definition: host_tensor.hpp:137
std::size_t get_element_space_size() const
Calculates the total element space required for the tensor in memory.
Definition: host_tensor.hpp:183
const std::vector< std::size_t > & get_strides() const
Definition: host_tensor.hpp:202
const std::vector< std::size_t > & get_lengths() const
Definition: host_tensor.hpp:198
std::size_t get_length(std::size_t dim) const
Definition: host_tensor.hpp:196
HostTensorDescriptor(const Lengths &lens, const Strides &strides)
Definition: host_tensor.hpp:148
HostTensorDescriptor()=default
HostTensorDescriptor(const std::initializer_list< X > &lens)
Definition: host_tensor.hpp:120
std::size_t GetOffsetFromMultiIndex(const std::vector< std::size_t > &iss) const
Calculates the linear memory offset from a multi-dimensional index.
Definition: host_tensor.hpp:233
HostTensorDescriptor(const Lengths &lens)
Definition: host_tensor.hpp:128
friend std::ostream & operator<<(std::ostream &os, const HostTensorDescriptor &desc)
Definition: host_tensor.hpp:238
Definition: host_tensor.hpp:336
std::size_t get_stride(std::size_t dim) const
Definition: host_tensor.hpp:392
HostTensor(HostTensor &&)=default
HostTensor(std::initializer_list< X > lens, std::initializer_list< Y > strides)
Definition: host_tensor.hpp:346
HostTensor & operator=(HostTensor &&)=default
friend std::ostream & operator<<(std::ostream &os, const HostTensor< T > &t)
Definition: host_tensor.hpp:639
HostTensor(std::initializer_list< X > lens)
Definition: host_tensor.hpp:341
HostTensor & operator=(const HostTensor &)=default
std::size_t get_element_space_size_in_bytes() const
Definition: host_tensor.hpp:406
HostTensor(const HostTensor &)=default
void GenerateTensorValue(G g, std::size_t num_thread=1)
Definition: host_tensor.hpp:461
~HostTensor()=default
std::size_t GetOffsetFromMultiIndex(Is... is) const
Definition: host_tensor.hpp:525
auto slice(std::vector< size_t > s_begin, std::vector< size_t > s_end) const
Definition: host_tensor.hpp:597
std::size_t get_num_of_dimension() const
Definition: host_tensor.hpp:396
std::size_t get_element_space_size() const
Definition: host_tensor.hpp:400
HostTensor()=delete
HostTensor(const Lengths &lens, const Strides &strides)
Definition: host_tensor.hpp:357
void loadtxt(std::string file_name, std::string dtype="float")
Definition: host_tensor.hpp:669
void ForEach_impl(const F &&f, std::vector< size_t > &idx, size_t rank) const
Definition: host_tensor.hpp:438
HostTensor< T > transpose(std::vector< size_t > axes={})
Definition: host_tensor.hpp:576
const T & operator()(const std::vector< std::size_t > &idx) const
Definition: host_tensor.hpp:548
void savetxt(std::string file_name, std::string dtype="float")
Definition: host_tensor.hpp:713
HostTensor(const HostTensor< FromT > &other)
Definition: host_tensor.hpp:384
HostTensor< T > transpose(std::vector< size_t > axes={}) const
Definition: host_tensor.hpp:553
std::size_t get_length(std::size_t dim) const
Definition: host_tensor.hpp:388
std::size_t get_element_size() const
Definition: host_tensor.hpp:398
T & operator()(const std::vector< std::size_t > &idx)
Definition: host_tensor.hpp:543
void ForEach_impl(F &&f, std::vector< size_t > &idx, size_t rank)
Definition: host_tensor.hpp:415
Definition: host_tensor.hpp:276
void operator()(std::size_t num_thread=1) const
Definition: host_tensor.hpp:306
ParallelTensorFunctor(F f, Xs... xs)
Definition: host_tensor.hpp:283
std::array< std::size_t, NDIM > mLens
Definition: host_tensor.hpp:279
std::array< std::size_t, NDIM > mStrides
Definition: host_tensor.hpp:280
static constexpr std::size_t NDIM
Definition: host_tensor.hpp:278
std::array< std::size_t, NDIM > GetNdIndices(std::size_t i) const
Definition: host_tensor.hpp:293
Definition: integral_constant.hpp:13
Definition: joinable_thread.hpp:12
Definition: numeric.hpp:81