ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NonZero.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <Logging.h>
11 
14 
15 namespace cloudViewer {
16 namespace core {
17 namespace kernel {
18 
19 Tensor NonZero(const Tensor& src) {
20  if (src.IsCPU()) {
21  return NonZeroCPU(src);
22  } else if (src.IsSYCL()) {
23 #ifdef BUILD_SYCL_MODULE
24  return NonZeroSYCL(src);
25 #else
26  utility::LogError("Not compiled with SYCL, but SYCL device is used.");
27 #endif
28  } else if (src.IsCUDA()) {
29 #ifdef BUILD_CUDA_MODULE
30  return NonZeroCUDA(src);
31 #else
32  utility::LogError("Not compiled with CUDA, but CUDA device is used.");
33 #endif
34  } else {
35  utility::LogError("NonZero: Unimplemented device");
36  }
37 }
38 
39 } // namespace kernel
40 } // namespace core
41 } // namespace cloudViewer
bool IsCUDA() const
Definition: Device.h:99
bool IsCPU() const
Definition: Device.h:95
#define LogError(...)
Definition: Logging.h:60
Tensor NonZero(const Tensor &src)
Definition: NonZero.cpp:19
Tensor NonZeroCPU(const Tensor &src)
Definition: NonZeroCPU.cpp:20
Tensor NonZeroSYCL(const Tensor &src)
Definition: NonZeroSYCL.cpp:22
Generic file read and write utility for python interface.