xgboost
|
命名空间 | |
detail | |
类 | |
class | TensorView |
具有静态类型和维度的张量视图。它实现了索引和切片。更多... | |
class | Tensor |
张量存储。要使用它进行切片等其他功能,首先需要获取一个视图。通过这种方式,我们可以在主机和设备上使用它。更多... | |
类型定义 | |
template<typename T > | |
using | VectorView = TensorView< T, 1 > |
向量视图,是 Tensor 的特化。更多... | |
template<typename T > | |
using | MatrixView = TensorView< T, 2 > |
矩阵视图,是 Tensor 的特化。更多... | |
template<typename T > | |
using | Matrix = Tensor< T, 2 > |
template<typename T > | |
using | Vector = Tensor< T, 1 > |
枚举 | |
enum | Order : std::uint8_t { kC , kF } |
函数 | |
constexpr detail::AllTag | All () |
指定轴上的所有元素用于切片。更多... | |
template<typename I > | |
constexpr detail::RangeTag< I > | Range (I beg, I end) |
指定轴上元素的范围用于切片。更多... | |
template<typename Container , typename... S, std::enable_if_t<!common::detail::IsSpan< Container >::value &&!std::is_pointer_v< Container >> * = nullptr> | |
auto | MakeTensorView (Context const *ctx, Container &data, S &&...shape) |
用于自动类型推导的构造函数。更多... | |
template<typename T , decltype(common::dynamic_extent) ext, typename... S> | |
LINALG_HD auto | MakeTensorView (DeviceOrd device, common::Span< T, ext > data, S &&...shape) |
template<typename T , decltype(common::dynamic_extent) ext, typename... S> | |
auto | MakeTensorView (Context const *ctx, common::Span< T, ext > data, S &&...shape) |
template<typename T , decltype(common::dynamic_extent) ext, typename... S> | |
auto | MakeTensorView (Context const *ctx, Order order, common::Span< T, ext > data, S &&...shape) |
template<typename T , typename... S> | |
auto | MakeTensorView (Context const *ctx, HostDeviceVector< T > *data, S &&...shape) |
template<typename T , typename... S> | |
auto | MakeTensorView (Context const *ctx, HostDeviceVector< T > const *data, S &&...shape) |
template<size_t D> | |
LINALG_HD auto | UnravelIndex (size_t idx, common::Span< size_t const, D > shape) |
将线性索引转换为多维索引。类似于 numpy unravel。更多... | |
template<size_t D> | |
LINALG_HD auto | UnravelIndex (size_t idx, std::size_t const (&shape)[D]) |
template<typename... S> | |
LINALG_HD auto | UnravelIndex (std::size_t idx, S... shape) |
template<typename T > | |
auto | MakeVec (T *ptr, size_t s, DeviceOrd device=DeviceOrd::CPU()) |
从连续内存创建向量视图。更多... | |
template<typename T > | |
auto | MakeVec (HostDeviceVector< T > *data) |
template<typename T > | |
auto | MakeVec (HostDeviceVector< T > const *data) |
template<typename T , std::int32_t D> | |
Json | ArrayInterface (TensorView< T const, D > const &t) |
由 numpy 定义的数组接口。更多... | |
template<typename T , int32_t D> | |
Json | ArrayInterface (TensorView< T, D > const &t) |
与 const 版本相同,但返回非只读数据指针。更多... | |
template<typename T , int32_t D> | |
auto | ArrayInterfaceStr (TensorView< T const, D > const &t) |
返回数组接口的字符串表示形式。更多... | |
template<typename T , int32_t D> | |
auto | ArrayInterfaceStr (TensorView< T, D > const &t) |
template<typename T > | |
auto | Make1dInterface (T const *vec, std::size_t len) |
template<typename T , typename... Index> | |
auto | Empty (Context const *ctx, Index &&...index) |
创建未初始化的数组。更多... | |
template<typename T , typename... Index> | |
auto | Constant (Context const *ctx, T v, Index &&...index) |
创建值为 v 的数组。更多... | |
template<typename T , typename... Index> | |
auto | Zeros (Context const *ctx, Index &&...index) |
类似于 np.zeros ,返回指定形状和类型的新数组,填充零。更多... | |
template<typename T , int32_t D> | |
void | Stack (Tensor< T, D > *l, Tensor< T, D > const &r) |
using xgboost::linalg::Matrix = typedef Tensor<T, 2> |
using xgboost::linalg::MatrixView = typedef TensorView<T, 2> |
矩阵视图,是 Tensor 的特化。
T | 矩阵的数据类型 |
using xgboost::linalg::Vector = typedef Tensor<T, 1> |
using xgboost::linalg::VectorView = typedef TensorView<T, 1> |
向量视图,是 Tensor 的特化。
T | 向量的数据类型 |
enum xgboost::linalg::Order : std::uint8_t |
|
constexpr |
指定轴上的所有元素用于切片。
Json xgboost::linalg::ArrayInterface | ( | TensorView< T const, D > const & | t | ) |
由 numpy 定义的数组接口。
当数据在 CUDA 设备上时,可选地包含 stream
。
Json xgboost::linalg::ArrayInterface | ( | TensorView< T, D > const & | t | ) |
与 const 版本相同,但返回非只读数据指针。
auto xgboost::linalg::ArrayInterfaceStr | ( | TensorView< T const, D > const & | t | ) |
返回数组接口的字符串表示形式。
auto xgboost::linalg::ArrayInterfaceStr | ( | TensorView< T, D > const & | t | ) |
auto xgboost::linalg::Constant | ( | Context const * | ctx, |
T | v, | ||
Index &&... | index | ||
) |
创建值为 v 的数组。
auto xgboost::linalg::Empty | ( | Context const * | ctx, |
Index &&... | index | ||
) |
创建未初始化的数组。
auto xgboost::linalg::Make1dInterface | ( | T const * | vec, |
std::size_t | len | ||
) |
auto xgboost::linalg::MakeTensorView | ( | Context const * | ctx, |
common::Span< T, ext > | data, | ||
S &&... | shape | ||
) |
auto xgboost::linalg::MakeTensorView | ( | Context const * | ctx, |
Container & | data, | ||
S &&... | shape | ||
) |
用于自动类型推导的构造函数。
auto xgboost::linalg::MakeTensorView | ( | Context const * | ctx, |
HostDeviceVector< T > * | data, | ||
S &&... | shape | ||
) |
auto xgboost::linalg::MakeTensorView | ( | Context const * | ctx, |
HostDeviceVector< T > const * | data, | ||
S &&... | shape | ||
) |
auto xgboost::linalg::MakeTensorView | ( | Context const * | ctx, |
Order | order, | ||
common::Span< T, ext > | data, | ||
S &&... | shape | ||
) |
LINALG_HD auto xgboost::linalg::MakeTensorView | ( | DeviceOrd | device, |
common::Span< T, ext > | data, | ||
S &&... | shape | ||
) |
auto xgboost::linalg::MakeVec | ( | HostDeviceVector< T > * | data | ) |
auto xgboost::linalg::MakeVec | ( | HostDeviceVector< T > const * | data | ) |
auto xgboost::linalg::MakeVec | ( | T * | ptr, |
size_t | s, | ||
DeviceOrd | device = DeviceOrd::CPU() |
||
) |
从连续内存创建向量视图。
ptr | 指向连续内存的指针。 |
s | 向量的大小。 |
device | (可选)设备序号,默认为主机。 |
|
constexpr |
指定轴上元素的范围用于切片。
void xgboost::linalg::Stack | ( | Tensor< T, D > * | l, |
Tensor< T, D > const & | r | ||
) |
LINALG_HD auto xgboost::linalg::UnravelIndex | ( | size_t | idx, |
common::Span< size_t const, D > | shape | ||
) |
将线性索引转换为多维索引。类似于 numpy unravel。
LINALG_HD auto xgboost::linalg::UnravelIndex | ( | size_t | idx, |
std::size_t const (&) | shape[D] | ||
) |
LINALG_HD auto xgboost::linalg::UnravelIndex | ( | std::size_t | idx, |
S... | shape | ||
) |
auto xgboost::linalg::Zeros | ( | Context const * | ctx, |
Index &&... | index | ||
) |
类似于 np.zeros
,返回指定形状和类型的新数组,填充零。