xgboost
|
Namespaces | |
detail | |
Classes | |
class | TensorView |
A tensor view with static type and dimension. It implements indexing and slicing. More... | |
class | Tensor |
A tensor storage. To use it for other functionality like slicing one needs to obtain a view first. This way we can use it on both host and device. More... | |
Typedefs | |
template<typename T > | |
using | VectorView = TensorView< T, 1 > |
A view over a vector, specialization of Tensor. More... | |
template<typename T > | |
using | MatrixView = TensorView< T, 2 > |
A view over a matrix, specialization of Tensor. More... | |
template<typename T > | |
using | Matrix = Tensor< T, 2 > |
template<typename T > | |
using | Vector = Tensor< T, 1 > |
Enumerations | |
enum | Order : std::uint8_t { kC , kF } |
Functions | |
constexpr detail::AllTag | All () |
Specify all elements in the axis for slicing. More... | |
template<typename I > | |
constexpr detail::RangeTag< I > | Range (I beg, I end) |
Specify a range of elements in the axis for slicing. More... | |
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) |
Constructor for automatic type deduction. More... | |
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) |
Turns linear index into multi-dimension index. Similar to numpy unravel. More... | |
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()) |
Create a vector view from contigious memory. More... | |
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) |
Array Interface defined by numpy. More... | |
template<typename T , int32_t D> | |
Json | ArrayInterface (TensorView< T, D > const &t) |
Same as const version, but returns non-readonly data pointer. More... | |
template<typename T , int32_t D> | |
auto | ArrayInterfaceStr (TensorView< T const, D > const &t) |
Return string representation of array interface. More... | |
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) |
Create an array without initialization. More... | |
template<typename T , typename... Index> | |
auto | Constant (Context const *ctx, T v, Index &&...index) |
Create an array with value v. More... | |
template<typename T , typename... Index> | |
auto | Zeros (Context const *ctx, Index &&...index) |
Like np.zeros , return a new array of given shape and type, filled with zeros. More... | |
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> |
A view over a matrix, specialization of Tensor.
T | data type of matrix |
using xgboost::linalg::Vector = typedef Tensor<T, 1> |
using xgboost::linalg::VectorView = typedef TensorView<T, 1> |
A view over a vector, specialization of Tensor.
T | data type of vector |
enum xgboost::linalg::Order : std::uint8_t |
|
constexpr |
Specify all elements in the axis for slicing.
Json xgboost::linalg::ArrayInterface | ( | TensorView< T const, D > const & | t | ) |
Array Interface defined by numpy.
stream
is optionally included when data is on CUDA device.
Json xgboost::linalg::ArrayInterface | ( | TensorView< T, D > const & | t | ) |
Same as const version, but returns non-readonly data pointer.
auto xgboost::linalg::ArrayInterfaceStr | ( | TensorView< T const, D > const & | t | ) |
Return string representation of array interface.
auto xgboost::linalg::ArrayInterfaceStr | ( | TensorView< T, D > const & | t | ) |
auto xgboost::linalg::Constant | ( | Context const * | ctx, |
T | v, | ||
Index &&... | index | ||
) |
Create an array with value v.
auto xgboost::linalg::Empty | ( | Context const * | ctx, |
Index &&... | index | ||
) |
Create an array without initialization.
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 | ||
) |
Constructor for automatic type deduction.
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() |
||
) |
Create a vector view from contigious memory.
ptr | Pointer to the contigious memory. |
s | Size of the vector. |
device | (optional) Device ordinal, default to be host. |
|
constexpr |
Specify a range of elements in the axis for slicing.
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 | ||
) |
Turns linear index into multi-dimension index. Similar to 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 | ||
) |
Like np.zeros
, return a new array of given shape and type, filled with zeros.