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

Function IntegerTensorEquals

cpp/src/arrow/compare.cc:1217–1245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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