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

Function ContiguousTensorCountNonZero

cpp/src/arrow/tensor.cc:506–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504
505template <typename TYPE>
506int64_t ContiguousTensorCountNonZero(const Tensor& tensor) {
507 using c_type = typename TYPE::c_type;
508 auto* data = reinterpret_cast<const c_type*>(tensor.raw_data());
509 return std::count_if(data, data + tensor.size(),
510 [](const c_type& x) { return x != 0; });
511}
512
513template <typename TYPE>
514inline 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