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

Function ContiguousTensorCountNonZero

cpp/src/arrow/tensor.cc:566–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564
565template <typename TYPE>
566int64_t ContiguousTensorCountNonZero(const Tensor& tensor) {
567 using c_type = typename TYPE::c_type;
568 auto* data = reinterpret_cast<const c_type*>(tensor.raw_data());
569 return std::count_if(data, data + tensor.size(),
570 [](const c_type& x) { return x != 0; });
571}
572
573template <typename TYPE>
574inline int64_t TensorCountNonZero(const Tensor& tensor) {

Callers

nothing calls this directly

Calls 2

raw_dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected