MCPcopy Create free account
hub / github.com/apache/arrow / IntegerTensorEquals

Function IntegerTensorEquals

cpp/src/arrow/compare.cc:1220–1248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220bool IntegerTensorEquals(const Tensor& left, const Tensor& right) {
1221 bool are_equal;
1222 // The arrays are the same object
1223 if (&left == &right) {
1224 are_equal = true;
1225 } else {
1226 const bool left_row_major_p = left.is_row_major();
1227 const bool left_column_major_p = left.is_column_major();
1228 const bool right_row_major_p = right.is_row_major();
1229 const bool right_column_major_p = right.is_column_major();
1230
1231 if (!(left_row_major_p && right_row_major_p) &&
1232 !(left_column_major_p && right_column_major_p)) {
1233 const auto& type = checked_cast<const FixedWidthType&>(*left.type());
1234 are_equal =
1235 StridedIntegerTensorContentEquals(0, 0, 0, type.byte_width(), left, right);
1236 } else {
1237 const int byte_width = left.type()->byte_width();
1238 DCHECK_GT(byte_width, 0);
1239
1240 const uint8_t* left_data = left.data()->data();
1241 const uint8_t* right_data = right.data()->data();
1242
1243 are_equal = memcmp(left_data, right_data,
1244 static_cast<size_t>(byte_width * left.size())) == 0;
1245 }
1246 }
1247 return are_equal;
1248}
1249
1250template <typename DataType>
1251bool StridedFloatTensorContentEquals(const int dim_index, int64_t left_offset,

Callers 1

TensorEqualsFunction · 0.85

Calls 7

is_row_majorMethod · 0.80
is_column_majorMethod · 0.80
typeMethod · 0.45
byte_widthMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected