Open3D (C++ API)  0.18.0+252c867
Macros | Functions
TensorFlowHelper.h File Reference

(252c867 (Sun May 5 05:39:34 2024 +0000))

#include <tensorflow/core/framework/op_kernel.h>
#include <tensorflow/core/framework/shape_inference.h>
#include <tensorflow/core/framework/tensor.h>
#include <tensorflow/core/lib/core/errors.h>
#include "open3d/ml/ShapeChecking.h"

Go to the source code of this file.

Macros

#define CHECK_SHAPE_HANDLE(ctx, shape_handle, ...)
 
#define CHECK_SHAPE_HANDLE_COMBINE_FIRST_DIMS(ctx, shape_handle, ...)
 
#define CHECK_SHAPE_HANDLE_IGNORE_FIRST_DIMS(ctx, shape_handle, ...)
 
#define CHECK_SHAPE_HANDLE_COMBINE_LAST_DIMS(ctx, shape_handle, ...)
 
#define CHECK_SHAPE_HANDLE_IGNORE_LAST_DIMS(ctx, shape_handle, ...)
 
#define CHECK_SHAPE(ctx, tensor, ...)
 
#define CHECK_SHAPE_COMBINE_FIRST_DIMS(ctx, tensor, ...)
 
#define CHECK_SHAPE_IGNORE_FIRST_DIMS(ctx, tensor, ...)
 
#define CHECK_SHAPE_COMBINE_LAST_DIMS(ctx, tensor, ...)
 
#define CHECK_SHAPE_IGNORE_LAST_DIMS(ctx, tensor, ...)
 

Functions

std::vector< open3d::ml::op_util::DimValueGetShapeVector (::tensorflow::shape_inference::InferenceContext *c, ::tensorflow::shape_inference::ShapeHandle shape_handle)
 
template<open3d::ml::op_util::CSOpt Opt = open3d::ml::op_util::CSOpt::NONE, class TDimX , class... TArgs>
std::tuple< bool, std::string > CheckShape (::tensorflow::shape_inference::InferenceContext *c, ::tensorflow::shape_inference::ShapeHandle shape_handle, TDimX &&dimex, TArgs &&... args)
 
std::vector< open3d::ml::op_util::DimValueGetShapeVector (const tensorflow::Tensor &tensor)
 
template<open3d::ml::op_util::CSOpt Opt = open3d::ml::op_util::CSOpt::NONE, class TDimX , class... TArgs>
std::tuple< bool, std::string > CheckShape (const tensorflow::Tensor &tensor, TDimX &&dimex, TArgs &&... args)
 
template<class TDimX , class... TArgs>
::tensorflow::shape_inference::ShapeHandle MakeShapeHandle (::tensorflow::shape_inference::InferenceContext *ctx, TDimX &&dimex, TArgs &&... args)
 

Macro Definition Documentation

◆ CHECK_SHAPE

#define CHECK_SHAPE (   ctx,
  tensor,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = CheckShape(tensor, __VA_ARGS__); \
OP_REQUIRES( \
ctx, cs_success_, \
tensorflow::errors::InvalidArgument( \
"invalid shape for '" #tensor "', " + cs_errstr_)); \
} while (0)
std::tuple< bool, std::string > CheckShape(::tensorflow::shape_inference::InferenceContext *c, ::tensorflow::shape_inference::ShapeHandle shape_handle, TDimX &&dimex, TArgs &&... args)
Definition: TensorFlowHelper.h:40

◆ CHECK_SHAPE_COMBINE_FIRST_DIMS

#define CHECK_SHAPE_COMBINE_FIRST_DIMS (   ctx,
  tensor,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::COMBINE_FIRST_DIMS>(tensor, __VA_ARGS__); \
OP_REQUIRES( \
ctx, cs_success_, \
tensorflow::errors::InvalidArgument( \
"invalid shape for '" #tensor "', " + cs_errstr_)); \
} while (0)

◆ CHECK_SHAPE_COMBINE_LAST_DIMS

#define CHECK_SHAPE_COMBINE_LAST_DIMS (   ctx,
  tensor,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::COMBINE_LAST_DIMS>(tensor, __VA_ARGS__); \
OP_REQUIRES( \
ctx, cs_success_, \
tensorflow::errors::InvalidArgument( \
"invalid shape for '" #tensor "', " + cs_errstr_)); \
} while (0)

◆ CHECK_SHAPE_HANDLE

#define CHECK_SHAPE_HANDLE (   ctx,
  shape_handle,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape(ctx, shape_handle, __VA_ARGS__); \
if (TF_PREDICT_FALSE(!cs_success_)) { \
return tensorflow::errors::InvalidArgument( \
"invalid shape for '" #shape_handle "', " + cs_errstr_); \
} \
} while (0)

◆ CHECK_SHAPE_HANDLE_COMBINE_FIRST_DIMS

#define CHECK_SHAPE_HANDLE_COMBINE_FIRST_DIMS (   ctx,
  shape_handle,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::COMBINE_FIRST_DIMS>(ctx, shape_handle, \
__VA_ARGS__); \
if (TF_PREDICT_FALSE(!cs_success_)) { \
return tensorflow::errors::InvalidArgument( \
"invalid shape for '" #shape_handle "', " + cs_errstr_); \
} \
} while (0)

◆ CHECK_SHAPE_HANDLE_COMBINE_LAST_DIMS

#define CHECK_SHAPE_HANDLE_COMBINE_LAST_DIMS (   ctx,
  shape_handle,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::COMBINE_LAST_DIMS>(ctx, shape_handle, \
__VA_ARGS__); \
if (TF_PREDICT_FALSE(!cs_success_)) { \
return tensorflow::errors::InvalidArgument( \
"invalid shape for '" #shape_handle "', " + cs_errstr_); \
} \
} while (0)

◆ CHECK_SHAPE_HANDLE_IGNORE_FIRST_DIMS

#define CHECK_SHAPE_HANDLE_IGNORE_FIRST_DIMS (   ctx,
  shape_handle,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::IGNORE_FIRST_DIMS>(ctx, shape_handle, \
__VA_ARGS__); \
if (TF_PREDICT_FALSE(!cs_success_)) { \
return tensorflow::errors::InvalidArgument( \
"invalid shape for '" #shape_handle "', " + cs_errstr_); \
} \
} while (0)

◆ CHECK_SHAPE_HANDLE_IGNORE_LAST_DIMS

#define CHECK_SHAPE_HANDLE_IGNORE_LAST_DIMS (   ctx,
  shape_handle,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::IGNORE_LAST_DIMS>(ctx, shape_handle, \
__VA_ARGS__); \
if (TF_PREDICT_FALSE(!cs_success_)) { \
return tensorflow::errors::InvalidArgument( \
"invalid shape for '" #shape_handle "', " + cs_errstr_); \
} \
} while (0)

◆ CHECK_SHAPE_IGNORE_FIRST_DIMS

#define CHECK_SHAPE_IGNORE_FIRST_DIMS (   ctx,
  tensor,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::IGNORE_FIRST_DIMS>(tensor, __VA_ARGS__); \
OP_REQUIRES( \
ctx, cs_success_, \
tensorflow::errors::InvalidArgument( \
"invalid shape for '" #tensor "', " + cs_errstr_)); \
} while (0)

◆ CHECK_SHAPE_IGNORE_LAST_DIMS

#define CHECK_SHAPE_IGNORE_LAST_DIMS (   ctx,
  tensor,
  ... 
)
Value:
do { \
bool cs_success_; \
std::string cs_errstr_; \
std::tie(cs_success_, cs_errstr_) = \
CheckShape<CSOpt::IGNORE_LAST_DIMS>(tensor, __VA_ARGS__); \
OP_REQUIRES( \
ctx, cs_success_, \
tensorflow::errors::InvalidArgument( \
"invalid shape for '" #tensor "', " + cs_errstr_)); \
} while (0)

Function Documentation

◆ CheckShape() [1/2]

template<open3d::ml::op_util::CSOpt Opt = open3d::ml::op_util::CSOpt::NONE, class TDimX , class... TArgs>
std::tuple<bool, std::string> CheckShape ( ::tensorflow::shape_inference::InferenceContext *  c,
::tensorflow::shape_inference::ShapeHandle  shape_handle,
TDimX &&  dimex,
TArgs &&...  args 
)

◆ CheckShape() [2/2]

template<open3d::ml::op_util::CSOpt Opt = open3d::ml::op_util::CSOpt::NONE, class TDimX , class... TArgs>
std::tuple<bool, std::string> CheckShape ( const tensorflow::Tensor &  tensor,
TDimX &&  dimex,
TArgs &&...  args 
)

◆ GetShapeVector() [1/2]

std::vector<open3d::ml::op_util::DimValue> GetShapeVector ( ::tensorflow::shape_inference::InferenceContext *  c,
::tensorflow::shape_inference::ShapeHandle  shape_handle 
)
inline

◆ GetShapeVector() [2/2]

std::vector<open3d::ml::op_util::DimValue> GetShapeVector ( const tensorflow::Tensor &  tensor)
inline

◆ MakeShapeHandle()

template<class TDimX , class... TArgs>
::tensorflow::shape_inference::ShapeHandle MakeShapeHandle ( ::tensorflow::shape_inference::InferenceContext *  ctx,
TDimX &&  dimex,
TArgs &&...  args 
)