ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TensorCheck.h File Reference
Include dependency graph for TensorCheck.h:

Go to the source code of this file.

Namespaces

 cloudViewer
 Generic file read and write utility for python interface.
 
 cloudViewer::core
 
 cloudViewer::core::tensor_check
 

Macros

#define AssertTensorDtype(tensor, ...)
 
#define AssertTensorDtypes(tensor, ...)
 
#define AssertTensorDevice(tensor, ...)
 
#define AssertTensorShape(tensor, ...)
 

Functions

void cloudViewer::core::tensor_check::AssertTensorDtype_ (const char *file, int line, const char *function, const Tensor &tensor, const Dtype &dtype)
 
void cloudViewer::core::tensor_check::AssertTensorDtypes_ (const char *file, int line, const char *function, const Tensor &tensor, const std::vector< Dtype > &dtypes)
 
void cloudViewer::core::tensor_check::AssertTensorDevice_ (const char *file, int line, const char *function, const Tensor &tensor, const Device &device)
 
void cloudViewer::core::tensor_check::AssertTensorShape_ (const char *file, int line, const char *function, const Tensor &tensor, const DynamicSizeVector &shape)
 

Macro Definition Documentation

◆ AssertTensorDevice

#define AssertTensorDevice (   tensor,
  ... 
)
Value:
__FILE__, __LINE__, \
static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
__VA_ARGS__)

Assert Tensor's device is the same as the expected device. When an error occurs, the corresponding file name, line number and function name will be printed in the error message.

Example: check that the tensor has device CUDA:0 core::AssertTensorDevice(tensor, core::Device("CUDA:0"));

◆ AssertTensorDtype

#define AssertTensorDtype (   tensor,
  ... 
)
Value:
__FILE__, __LINE__, \
static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
__VA_ARGS__)

Assert Tensor's dtype is the same as the expected dtype. When an error occurs, the corresponding file name, line number and function name will be printed in the error message.

Example: check that the tensor has dtype Float32 core::AssertTensorDtype(tensor, core::Float32);

◆ AssertTensorDtypes

#define AssertTensorDtypes (   tensor,
  ... 
)
Value:
__FILE__, __LINE__, \
static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
__VA_ARGS__)

Assert Tensor's dtype is among one of the expected dtypes. When an error occurs, the corresponding file name, line number and function name will be printed in the error message.

Example: check that the tensor has dtype Float32 or Float64 core::AssertTensorDtypes(tensor, {core::Float32, core::Float64});

◆ AssertTensorShape

#define AssertTensorShape (   tensor,
  ... 
)
Value:
__FILE__, __LINE__, \
static_cast<const char*>(CLOUDVIEWER_FUNCTION), tensor, \
__VA_ARGS__)

Assert Tensor's shape is the same as the expected shape. AssertTensorShape takes a shape (SizeVector) or dynamic shape (DynamicSizeVector). When an error occurs, the corresponding file name, line number and function name will be printed in the error message.

Example: check that the tensor has shape {100, 3} core::AssertTensorShape(tensor, {100, 3});

Example: check that the tensor has shape {N, 3} core::AssertTensorShape(tensor, {utility::nullopt, 3});

cloudViewer::core::tensor_check::AssertTensorDtype_
void AssertTensorDtype_(const char *file, int line, const char *function, const Tensor &tensor, const Dtype &dtype)
Definition: TensorCheck.cpp:23
cloudViewer::core::tensor_check::AssertTensorShape_
void AssertTensorShape_(const char *file, int line, const char *function, const Tensor &tensor, const DynamicSizeVector &shape)
Definition: TensorCheck.cpp:72
cloudViewer::core::tensor_check::AssertTensorDtypes_
void AssertTensorDtypes_(const char *file, int line, const char *function, const Tensor &tensor, const std::vector< Dtype > &dtypes)
Definition: TensorCheck.cpp:37
cloudViewer::core::tensor_check::AssertTensorDevice_
void AssertTensorDevice_(const char *file, int line, const char *function, const Tensor &tensor, const Device &device)
Definition: TensorCheck.cpp:58
CLOUDVIEWER_FUNCTION
#define CLOUDVIEWER_FUNCTION
Definition: Macro.h:43