Span class. (#3548)
* Add basic Span class based on ISO++20. * Use Span<Entry const> instead of Inst in SparsePage. * Add DeviceSpan in HostDeviceVector, use it in regression obj.
This commit is contained in:
committed by
Rory Mitchell
parent
2b7a1c5780
commit
2c502784ff
@@ -25,7 +25,7 @@ TEST(SimpleCSRSource, SaveLoadBinary) {
|
||||
row_iter_read->BeforeFirst(); row_iter_read->Next();
|
||||
auto first_row = row_iter->Value()[0];
|
||||
auto first_row_read = row_iter_read->Value()[0];
|
||||
EXPECT_EQ(first_row.length, first_row_read.length);
|
||||
EXPECT_EQ(first_row.size(), first_row_read.size());
|
||||
EXPECT_EQ(first_row[2].index, first_row_read[2].index);
|
||||
EXPECT_EQ(first_row[2].fvalue, first_row_read[2].fvalue);
|
||||
row_iter = nullptr; row_iter_read = nullptr;
|
||||
|
||||
@@ -31,7 +31,7 @@ TEST(SimpleDMatrix, RowAccess) {
|
||||
row_iter->BeforeFirst();
|
||||
row_iter->Next();
|
||||
auto first_row = row_iter->Value()[0];
|
||||
ASSERT_EQ(first_row.length, 3);
|
||||
ASSERT_EQ(first_row.size(), 3);
|
||||
EXPECT_EQ(first_row[2].index, 2);
|
||||
EXPECT_EQ(first_row[2].fvalue, 20);
|
||||
row_iter = nullptr;
|
||||
@@ -70,7 +70,7 @@ TEST(SimpleDMatrix, ColAccessWithoutBatches) {
|
||||
EXPECT_EQ(col_iter->Value().Size(), dmat->Info().num_col_)
|
||||
<< "Expected batch size = number of cells as #batches is 1.";
|
||||
for (int i = 0; i < static_cast<int>(col_iter->Value().Size()); ++i) {
|
||||
EXPECT_EQ(col_iter->Value()[i].length, dmat->GetColSize(i))
|
||||
EXPECT_EQ(col_iter->Value()[i].size(), dmat->GetColSize(i))
|
||||
<< "Expected length of each colbatch = colsize as #batches is 1.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ TEST(SparsePageDMatrix, RowAccess) {
|
||||
row_iter->BeforeFirst();
|
||||
row_iter->Next();
|
||||
auto first_row = row_iter->Value()[0];
|
||||
ASSERT_EQ(first_row.length, 3);
|
||||
ASSERT_EQ(first_row.size(), 3);
|
||||
EXPECT_EQ(first_row[2].index, 2);
|
||||
EXPECT_EQ(first_row[2].fvalue, 20);
|
||||
row_iter = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user