MCPcopy Create free account
hub / github.com/dmlc/xgboost / Initialize

Method Initialize

include/xgboost/linalg.h:771–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769
770 template <typename I, std::int32_t D>
771 void Initialize(I const (&shape)[D], DeviceOrd device) {
772 static_assert(D <= kDim, "Invalid shape.");
773 std::copy(shape, shape + D, shape_);
774 for (auto i = D; i < kDim; ++i) {
775 shape_[i] = 1;
776 }
777 if (!device.IsCPU()) {
778 data_.SetDevice(device);
779 data_.ConstDevicePointer(); // Pull to device;
780 }
781 CHECK_EQ(data_.Size(), detail::CalcSize(shape_));
782 }
783
784 public:
785 Tensor() = default;

Callers 1

TensorMethod · 0.95

Calls 5

CalcSizeFunction · 0.85
IsCPUMethod · 0.45
SetDeviceMethod · 0.45
ConstDevicePointerMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected