Open3D (C++ API)  0.18.0+5c982c7
TensorCheck.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "open3d/Macro.h"
11 #include "open3d/core/Device.h"
12 #include "open3d/core/Dtype.h"
13 #include "open3d/core/Tensor.h"
14 
21 #define AssertTensorDtype(tensor, ...) \
22  tensor_check::AssertTensorDtype_( \
23  __FILE__, __LINE__, static_cast<const char*>(OPEN3D_FUNCTION), \
24  tensor, __VA_ARGS__)
25 
32 #define AssertTensorDtypes(tensor, ...) \
33  tensor_check::AssertTensorDtypes_( \
34  __FILE__, __LINE__, static_cast<const char*>(OPEN3D_FUNCTION), \
35  tensor, __VA_ARGS__)
36 
43 #define AssertTensorDevice(tensor, ...) \
44  tensor_check::AssertTensorDevice_( \
45  __FILE__, __LINE__, static_cast<const char*>(OPEN3D_FUNCTION), \
46  tensor, __VA_ARGS__)
47 
58 #define AssertTensorShape(tensor, ...) \
59  tensor_check::AssertTensorShape_( \
60  __FILE__, __LINE__, static_cast<const char*>(OPEN3D_FUNCTION), \
61  tensor, __VA_ARGS__)
62 
63 namespace open3d {
64 namespace core {
65 namespace tensor_check {
66 
67 void AssertTensorDtype_(const char* file,
68  int line,
69  const char* function,
70  const Tensor& tensor,
71  const Dtype& dtype);
72 
73 void AssertTensorDtypes_(const char* file,
74  int line,
75  const char* function,
76  const Tensor& tensor,
77  const std::vector<Dtype>& dtypes);
78 
79 void AssertTensorDevice_(const char* file,
80  int line,
81  const char* function,
82  const Tensor& tensor,
83  const Device& device);
84 
85 void AssertTensorShape_(const char* file,
86  int line,
87  const char* function,
88  const Tensor& tensor,
89  const DynamicSizeVector& shape);
90 
91 } // namespace tensor_check
92 } // namespace core
93 } // namespace open3d
void AssertTensorShape_(const char *file, int line, const char *function, const Tensor &tensor, const DynamicSizeVector &shape)
Definition: TensorCheck.cpp:71
void AssertTensorDtype_(const char *file, int line, const char *function, const Tensor &tensor, const Dtype &dtype)
Definition: TensorCheck.cpp:22
void AssertTensorDevice_(const char *file, int line, const char *function, const Tensor &tensor, const Device &device)
Definition: TensorCheck.cpp:57
void AssertTensorDtypes_(const char *file, int line, const char *function, const Tensor &tensor, const std::vector< Dtype > &dtypes)
Definition: TensorCheck.cpp:36
Definition: PinholeCameraIntrinsic.cpp:16