xgboost
|
张量存储。若要使用切片等其他功能,需要先获取一个视图。这样我们就可以在主机和设备上使用它。更多...
#include <linalg.h>
公有类型 | |
使用 | ShapeT = std::size_t[kDim] |
使用 | StrideT = ShapeT |
公有成员函数 | |
Tensor ()=default | |
template<typename I , int32_t D> | |
Tensor (I const (&shape)[D], DeviceOrd device, Order order=kC) | |
创建具有形状和设备序号的张量。存储会自动初始化。更多... | |
template<typename I , size_t D> | |
Tensor (common::Span< I const, D > shape, DeviceOrd device, Order order=kC) | |
template<typename It , typename I , int32_t D> | |
Tensor (It begin, It end, I const (&shape)[D], DeviceOrd device, Order order=kC) | |
template<typename I , int32_t D> | |
Tensor (std::initializer_list< T > data, I const (&shape)[D], DeviceOrd device, Order order=kC) | |
template<typename... Index> | |
T & | operator() (Index &&...idx) |
索引操作符。非线程安全,不应在性能关键区域使用。为了更高效的索引,请考虑先获取一个视图。更多... | |
template<typename... Index> | |
T const & | operator() (Index &&...idx) const |
索引操作符。非线程安全,不应在性能关键区域使用。为了更高效的索引,请考虑先获取一个视图。更多... | |
auto | View (DeviceOrd device) |
获取此张量的 TensorView。更多... | |
auto | View (DeviceOrd device) const |
auto | HostView () |
auto | HostView () const |
std::size_t | Size () const |
bool | Empty () const |
auto | Shape () const |
auto | Shape (size_t i) const |
HostDeviceVector< T > * | Data () |
HostDeviceVector< T > const * | Data () const |
template<typename Fn > | |
void | ModifyInplace (Fn &&fn) |
用于修改形状和数据的访问函数。更多... | |
template<typename... S, detail::EnableIfIntegral< S... > * = nullptr> | |
void | Reshape (S &&...s) |
重塑张量。更多... | |
template<size_t D> | |
void | Reshape (common::Span< size_t const, D > shape) |
重塑张量。更多... | |
template<size_t D> | |
void | Reshape (size_t(&shape)[D]) |
template<typename... S> | |
auto | Slice (S &&...slices) const |
获取切片的主机视图。更多... | |
template<typename... S> | |
auto | Slice (S &&...slices) |
获取切片的主机视图。更多... | |
void | SetDevice (DeviceOrd device) const |
设置此张量的设备序号。更多... | |
DeviceOrd | Device () const |
张量存储。若要使用切片等其他功能,需要先获取一个视图。这样我们就可以在主机和设备上使用它。
使用 xgboost::linalg::Tensor< T, kDim >::ShapeT = std::size_t[kDim] |
使用 xgboost::linalg::Tensor< T, kDim >::StrideT = ShapeT |
|
默认 |
|
内联显式 |
创建具有形状和设备序号的张量。存储会自动初始化。
请参阅 TensorView 以了解此构造函数的参数。
|
内联显式 |
|
内联显式 |
从 2 个主机迭代器初始化。
|
内联显式 |
|
内联 |
|
内联 |
|
内联 |
|
内联 |
|
内联 |
|
内联 |
|
内联 |
用于修改形状和数据的访问函数。
Fn | 一个函数,它接受指向 HostDeviceVector 的指针和一个静态大小的 Span 作为参数。 |
|
内联 |
索引操作符。非线程安全,不应在性能关键区域使用。为了更高效的索引,请考虑先获取一个视图。
|
内联 |
索引操作符。非线程安全,不应在性能关键区域使用。为了更高效的索引,请考虑先获取一个视图。
|
内联 |
重塑张量。
如果总大小发生改变,则此张量中的数据将不再有效。
|
内联 |
重塑张量。
如果总大小发生改变,则此张量中的数据将不再有效。
|
内联 |
|
内联 |
设置此张量的设备序号。
|
内联 |
|
内联 |
|
内联 |
|
内联 |
获取切片的主机视图。
|
内联 |
获取切片的主机视图。
|
内联 |
获取此张量的 TensorView。
|
内联 |