ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TensorCheck.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 "cloudViewer/Macro.h"
12 #include "cloudViewer/core/Dtype.h"
14 
21 #define AssertTensorDtype(tensor, ...) \
22  tensor_check::AssertTensorDtype_( \
23  __FILE__, __LINE__, \
24  static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
25  __VA_ARGS__)
26 
33 #define AssertTensorDtypes(tensor, ...) \
34  tensor_check::AssertTensorDtypes_( \
35  __FILE__, __LINE__, \
36  static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
37  __VA_ARGS__)
38 
45 #define AssertTensorDevice(tensor, ...) \
46  tensor_check::AssertTensorDevice_( \
47  __FILE__, __LINE__, \
48  static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
49  __VA_ARGS__)
50 
61 #define AssertTensorShape(tensor, ...) \
62  tensor_check::AssertTensorShape_( \
63  __FILE__, __LINE__, \
64  static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
65  __VA_ARGS__)
66 
67 namespace cloudViewer {
68 namespace core {
69 namespace tensor_check {
70 
71 void AssertTensorDtype_(const char* file,
72  int line,
73  const char* function,
74  const Tensor& tensor,
75  const Dtype& dtype);
76 
77 void AssertTensorDtypes_(const char* file,
78  int line,
79  const char* function,
80  const Tensor& tensor,
81  const std::vector<Dtype>& dtypes);
82 
83 void AssertTensorDevice_(const char* file,
84  int line,
85  const char* function,
86  const Tensor& tensor,
87  const Device& device);
88 
89 void AssertTensorShape_(const char* file,
90  int line,
91  const char* function,
92  const Tensor& tensor,
93  const DynamicSizeVector& shape);
94 
95 } // namespace tensor_check
96 } // namespace core
97 } // namespace cloudViewer
void AssertTensorDtypes_(const char *file, int line, const char *function, const Tensor &tensor, const std::vector< Dtype > &dtypes)
Definition: TensorCheck.cpp:37
void AssertTensorDtype_(const char *file, int line, const char *function, const Tensor &tensor, const Dtype &dtype)
Definition: TensorCheck.cpp:23
void AssertTensorDevice_(const char *file, int line, const char *function, const Tensor &tensor, const Device &device)
Definition: TensorCheck.cpp:58
void AssertTensorShape_(const char *file, int line, const char *function, const Tensor &tensor, const DynamicSizeVector &shape)
Definition: TensorCheck.cpp:72
Generic file read and write utility for python interface.