ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
IndexGetSet.h
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 
8 #pragma once
9 
10 #include <Logging.h>
11 
13 
14 namespace cloudViewer {
15 namespace core {
16 namespace kernel {
17 
18 void IndexGet(const Tensor& src,
19  Tensor& dst,
20  const std::vector<Tensor>& index_tensors,
21  const SizeVector& indexed_shape,
22  const SizeVector& indexed_strides);
23 
24 void IndexGetCPU(const Tensor& src,
25  Tensor& dst,
26  const std::vector<Tensor>& index_tensors,
27  const SizeVector& indexed_shape,
28  const SizeVector& indexed_strides);
29 
30 #ifdef BUILD_SYCL_MODULE
31 void IndexGetSYCL(const Tensor& src,
32  Tensor& dst,
33  const std::vector<Tensor>& index_tensors,
34  const SizeVector& indexed_shape,
35  const SizeVector& indexed_strides);
36 #endif
37 
38 #ifdef BUILD_CUDA_MODULE
39 void IndexGetCUDA(const Tensor& src,
40  Tensor& dst,
41  const std::vector<Tensor>& index_tensors,
42  const SizeVector& indexed_shape,
43  const SizeVector& indexed_strides);
44 #endif
45 
46 void IndexSet(const Tensor& src,
47  Tensor& dst,
48  const std::vector<Tensor>& index_tensors,
49  const SizeVector& indexed_shape,
50  const SizeVector& indexed_strides);
51 
52 void IndexSetCPU(const Tensor& src,
53  Tensor& dst,
54  const std::vector<Tensor>& index_tensors,
55  const SizeVector& indexed_shape,
56  const SizeVector& indexed_strides);
57 
58 #ifdef BUILD_SYCL_MODULE
59 void IndexSetSYCL(const Tensor& src,
60  Tensor& dst,
61  const std::vector<Tensor>& index_tensors,
62  const SizeVector& indexed_shape,
63  const SizeVector& indexed_strides);
64 #endif
65 
66 #ifdef BUILD_CUDA_MODULE
67 void IndexSetCUDA(const Tensor& src,
68  Tensor& dst,
69  const std::vector<Tensor>& index_tensors,
70  const SizeVector& indexed_shape,
71  const SizeVector& indexed_strides);
72 #endif
73 
74 } // namespace kernel
75 } // namespace core
76 } // namespace cloudViewer
cloudViewer::core::kernel::CPULogicalAndElementKernel
static void CPULogicalAndElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:92
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
cloudViewer::core::kernel::CPULeqElementKernel
static void CPULeqElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:137
Indexer.h
cloudViewer::core::kernel::BinaryEWOpCode::Div
@ Div
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::core::kernel::LaunchBinaryEWKernel
static void LaunchBinaryEWKernel(const Indexer &indexer, const element_func_t &element_func)
Definition: BinaryEWCPU.cpp:28
cloudViewer::core::kernel::CPUNeqElementKernel
static void CPUNeqElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:149
cloudViewer::core::kernel::CPULtElementKernel
static void CPULtElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:125
cloudViewer::core::IsDevice::IsCUDA
bool IsCUDA() const
Definition: Device.h:99
cloudViewer::core::kernel::BinaryEWOpCode::Maximum
@ Maximum
cloudViewer::core::kernel::BinaryEWOpCode::LogicalXor
@ LogicalXor
cloudViewer::core::kernel::BinaryEWOpCode::Minimum
@ Minimum
cloudViewer::core::kernel::CPUGeqElementKernel
static void CPUGeqElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:131
cloudViewer::core::kernel::CPUMulElementKernel
static void CPUMulElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:80
cloudViewer::core::kernel::BinaryEWCPU
void BinaryEWCPU(const Tensor &lhs, const Tensor &rhs, Tensor &dst, BinaryEWOpCode op_code)
Definition: BinaryEWCPU.cpp:154
cloudViewer::core::Tensor
Definition: Tensor.h:32
ParallelForSYCL.h
cloudViewer::core::kernel::IndexGet
void IndexGet(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSet.cpp:22
cloudViewer::core::kernel::BinaryEWOpCode::Gt
@ Gt
cloudViewer::core::Dtype
Definition: Dtype.h:21
cloudViewer::core::ParallelForSYCL
void ParallelForSYCL(const Device &device, Indexer indexer, FuncArgs... func_args)
Run a function in parallel with SYCL.
Definition: ParallelForSYCL.h:24
cloudViewer::core::kernel::CPUGtElementKernel
static void CPUGtElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:119
cloudViewer::core::kernel::IndexSet
void IndexSet(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSet.cpp:52
cloudViewer::core::kernel::CPUDivElementKernel
static void CPUDivElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:86
BINARY_ELEMENT_KERNEL
#define BINARY_ELEMENT_KERNEL(name, elem_fn)
Definition: BinaryEWSYCL.cpp:98
ParallelFor.h
SizeVector.h
cloudViewer::core::kernel::BinaryEWOpCode
BinaryEWOpCode
Definition: BinaryEW.h:21
cloudViewer::core::kernel::CPUEqElementKernel
static void CPUEqElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:143
cloudViewer::core::kernel::IndexSetSYCL
void IndexSetSYCL(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSetSYCL.cpp:46
UnaryEW.h
cloudViewer::core::DtypePolicy::INPUT_SAME_OUTPUT_BOOL
@ INPUT_SAME_OUTPUT_BOOL
cloudViewer::core::DtypePolicy::ALL_SAME
@ ALL_SAME
cloudViewer::core::kernel::IndexGetCPU
void IndexGetCPU(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSetCPU.cpp:42
Dispatch.h
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::core::kernel::BinaryEWSYCL
void BinaryEWSYCL(const Tensor &lhs, const Tensor &rhs, Tensor &dst, BinaryEWOpCode op_code)
Definition: BinaryEWSYCL.cpp:116
cloudViewer::core::kernel::CPUMinElementKernel
static void CPUMinElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:62
core
cloudViewer::core::Bool
const Dtype Bool
Definition: Dtype.cpp:52
cloudViewer::core::kernel::IndexGetSYCL
void IndexGetSYCL(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSetSYCL.cpp:18
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::Tensor::CopyFrom
void CopyFrom(const Tensor &other)
Copy Tensor values to current tensor from the source tensor.
Definition: Tensor.cpp:770
DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL
#define DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL(DTYPE,...)
Definition: Dispatch.h:68
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
cloudViewer::core::kernel::BinaryEWOpCode::Sub
@ Sub
indexer
Indexer indexer
Definition: BinaryEWSYCL.cpp:30
cloudViewer::core::kernel::BinaryEWOpCode::Ge
@ Ge
cloudViewer::core::kernel::CPULogicalOrElementKernel
static void CPULogicalOrElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:101
cloudViewer::core::kernel::BinaryEWOpCode::Eq
@ Eq
LogError
#define LogError(...)
Definition: Logging.h:60
DISPATCH_DTYPE_TO_TEMPLATE
#define DISPATCH_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:31
cloudViewer::core::kernel::CPUAddElementKernel
static void CPUAddElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:68
cloudViewer::core::kernel::BinaryEWOpCode::Ne
@ Ne
cloudViewer::core::kernel::s_boolean_binary_ew_op_codes
const std::unordered_set< BinaryEWOpCode, utility::hash_enum_class > s_boolean_binary_ew_op_codes
Definition: BinaryEW.cpp:22
cloudViewer::core::IsDevice::IsCPU
bool IsCPU() const
Definition: Device.h:95
cloudViewer::core::kernel::BinaryEWOpCode::Mul
@ Mul
IndexGetSet.h
cloudViewer::core::kernel::BinaryEWOpCode::Add
@ Add
CLOUDVIEWER_TEMPLATE_VECTORIZED
#define CLOUDVIEWER_TEMPLATE_VECTORIZED(T, ISPCKernel,...)
Definition: ParallelFor.h:246
Tensor.h
cloudViewer::core::IsDevice::IsSYCL
bool IsSYCL() const
Definition: Device.h:103
cloudViewer::core::ParallelFor
void ParallelFor(const Device &device, int64_t n, const func_t &func)
Definition: ParallelFor.h:111
cloudViewer::core::kernel::BinaryEWOpCode::Le
@ Le
cloudViewer::core::kernel::CPUSubElementKernel
static void CPUSubElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:74
BinaryEW.h
cloudViewer::core::Indexer
Definition: Indexer.h:262
cloudViewer::core::kernel::BinaryEWOpCode::LogicalOr
@ LogicalOr
MemoryManager.h
cloudViewer::core::kernel::CPUMaxElementKernel
static void CPUMaxElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:56
Dtype.h
cloudViewer::core::Tensor::To
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
cloudViewer::core::kernel::CPULogicalXorElementKernel
static void CPULogicalXorElementKernel(const void *lhs, const void *rhs, void *dst)
Definition: BinaryEWCPU.cpp:110
cloudViewer::core::kernel::IndexSetCPU
void IndexSetCPU(const Tensor &src, Tensor &dst, const std::vector< Tensor > &index_tensors, const SizeVector &indexed_shape, const SizeVector &indexed_strides)
Definition: IndexGetSetCPU.cpp:62
cloudViewer::core::kernel::BinaryEWOpCode::Lt
@ Lt
cloudViewer::core::kernel::BinaryEWOpCode::LogicalAnd
@ LogicalAnd