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

Function ContiguousTensorCountNonZero

cpp/src/arrow/tensor.cc:598–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596
597template <typename TYPE>
598int64_t ContiguousTensorCountNonZero(const Tensor& tensor) {
599 using c_type = typename TYPE::c_type;
600 auto* data = reinterpret_cast<const c_type*>(tensor.raw_data());
601 return std::count_if(data, data + tensor.size(),
602 [](const c_type& x) { return x != 0; });
603}
604
605template <typename TYPE>
606inline 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