Caffe2 - C++ API
A deep learning, cross platform ML framework
Data Structures | Typedefs | Functions | Variables
caffe2::detail Namespace Reference

To make a c10 operator "C10Add" callable from caffe2 as "C2MyAddOpName", just write. More...

Data Structures

class  _guard_long_unique_dummy
 
struct  _ScopeGuard
 
class  _Uninitialized
 
class  C10OperatorWrapper
 
struct  Link
 
struct  OffsetAlias
 
struct  Param
 
struct  RecurrentGradient
 
struct  RecurrentInput
 
class  ScopeGuardImpl
 
class  ScopeGuardImplBase
 
struct  ScratchWorkspaces
 
class  TensorDescriptors
 
struct  TypeMetaData
 
class  WorkspaceStack
 

Typedefs

template<class T >
using _guard_long_unique = c10::guts::conditional_t< std::is_same< long, int32_t >::value||std::is_same< long, int64_t >::value, _guard_long_unique_dummy< T >, T >
 
using _CallCaffe2OpFunc = std::vector< at::Tensor >(const c10::FunctionSchema &schema, std::vector< c10::IValue > &&inputs, std::vector< at::Tensor > &&outputs)
 
template<typename F >
using ScopeGuardImplDecay = ScopeGuardImpl< typename std::decay< F >::type >
 

Functions

C10_EXPORT void _ThrowRuntimeTypeLogicError (const string &msg)
 
C10_API void _ThrowRuntimeTypeLogicError (const std::string &msg)
 
template<typename T >
void _PlacementNew (void *ptr, size_t n)
 Placement new function for the type.
 
template<typename T >
void _PlacementNewNotDefault (void *, size_t)
 
template<typename T , c10::guts::enable_if_t< std::is_default_constructible< T >::value > * = nullptr>
constexpr TypeMetaData::PlacementNew * _PickPlacementNew ()
 
template<typename T >
void * _New ()
 
template<typename T >
void * _NewNotDefault ()
 
template<typename T , c10::guts::enable_if_t< std::is_default_constructible< T >::value > * = nullptr>
constexpr TypeMetaData::New * _PickNew ()
 
template<typename T >
void _Copy (const void *src, void *dst, size_t n)
 Typed copy function for classes.
 
template<typename T >
void _CopyNotAllowed (const void *, void *, size_t)
 A placeholder function for types that do not allow assignment.
 
template<typename T , c10::guts::enable_if_t< std::is_copy_assignable< T >::value > * = nullptr>
constexpr TypeMetaData::Copy * _PickCopy ()
 
template<typename T >
void _PlacementDelete (void *ptr, size_t n)
 Destructor for non-fundamental types.
 
template<typename T >
constexpr TypeMetaData::PlacementDelete * _PickPlacementDelete ()
 
template<typename T >
void _Delete (void *ptr)
 
template<class T >
constexpr TypeMetaData::Delete * _PickDelete () noexcept
 
template<class T >
constexpr const char * _typeName (const char *literalName) noexcept
 
template<class T >
TypeMetaData _makeTypeMetaDataInstance (const char *typeName)
 
template<typename SrcType , typename DstType >
void CopyToProtoAsIs (const size_t size, const SrcType *src, google::protobuf::RepeatedField< DstType > *field, BaseContext *context)
 
template<typename SrcType , typename DstType >
void CopyToProtoWithCast (const size_t size, const SrcType *src, google::protobuf::RepeatedField< DstType > *field, BaseContext *context)
 
template<typename SrcType , typename DstType >
void CopyFromProtoAsIs (const size_t size, const google::protobuf::RepeatedField< SrcType > &field, DstType *dst, BaseContext *context)
 
template<typename SrcType , typename DstType >
void CopyFromProtoWithCast (const size_t size, const google::protobuf::RepeatedField< SrcType > &field, DstType *dst, BaseContext *context)
 
template<class Caffe2Operator >
std::vector< at::Tensor_call_caffe2_op (const c10::FunctionSchema &schema, std::vector< c10::IValue > &&inputs, std::vector< at::Tensor > &&outputs)
 
void _call_caffe2_op_from_c10 (c10::Stack *stack, const c10::FunctionSchema &schema, _CallCaffe2OpFunc *call_op)
 
template<const c10::OperatorHandle &(*)() OpHandle, class Caffe2Operator >
void call_caffe2_op_from_c10 (c10::Stack *stack, c10::KernelCache *cache)
 
c10::FunctionSchema make_function_schema_for_c10 (const char *OperatorName, std::vector< c10::Argument > inputs, std::vector< c10::Argument > outputs)
 
template<class Context >
std::function< std::unique_ptr< OperatorBase >const OperatorDef &, Workspace *)> createC10OperatorWrapper (const c10::OperatorHandle &op_handle)
 
template<class T >
_ScopeGuard< TScopeGuard (T f)
 
template<typename T >
T sigmoid (T x)
 
template<typename T >
T host_tanh (T x)
 
template<typename T , typename Context >
void GRUUnit (int N, int D, int t, const T *H_prev, const T *X, const int32_t *seqLengths, bool drop_states, T *H, Context *)
 
template<typename T , typename Context >
void GRUUnitGradient (int N, int D, int t, const T *H_prev, const T *X, const int32_t *seqLengths, const T *H, const T *H_diff, bool drop_states, T *H_prev_diff, T *X_diff, Context *)
 
template<typename T , typename Context >
void LSTMUnit (int N, int D, int t, const T *H_prev, const T *C_prev, const T *X, const int32_t *seqLengths, bool drop_states, T *C, T *H, const float forget_bias, Context *)
 
template<typename T , typename Context >
void LSTMUnitGradient (int N, int D, int t, const T *C_prev, const T *X, const int32_t *seqLengths, const T *C, const T *H, const T *C_diff, const T *H_diff, bool drop_states, T *H_prev_diff, T *C_prev_diff, T *X_diff, const float forget_bias, Context *)
 
std::map< string, string > GetRecurrentMapping (const std::vector< detail::Link > &links, bool backward)
 
void PrependOps (std::vector< OperatorDef > ops, NetDef *netdef)
 
void AddApplyLinkOps (const vector< Link > &links, std::string timestep, const DeviceOption &device_option, NetDef *netdef)
 
void extractLinks (OperatorBase *op, const std::string &internalArg, const std::string &externalArg, const std::string &offsetArg, const std::string &windowArg, std::vector< detail::Link > *links)
 
NetDef extractNetDef (const OperatorDef &op, const std::string &argName)
 
void UpdateTimestepBlob (Workspace *ws, std::string blob_name, int t)
 
template<typename T , typename Context >
void applyOffsetAlias (const OffsetAlias &oc, Workspace *ws, Context *)
 
template<typename T , class Context >
void repeatCopy (size_t repeat_n, size_t n, const T *src, T *dst, Context *context)
 
template<typename T , typename Context >
void initializeRecurrentInput (const RecurrentInput &rc, int32_t seqLen, int32_t batchSize, Workspace *ws, Context *context)
 Copy external input to the step net into the first item of (T + 1) X batch_size X input_size tensor.
 
template<typename T , typename Context >
void VariableLengthSequencePadding (int N, int B, int M, T *X, const int32_t *seqLengths, const T padValue, Context *)
 

Variables

const TypeMetaData _typeMetaDataInstance_uninitialized_ = detail::TypeMetaData(0, nullptr, nullptr, nullptr, nullptr, nullptr, TypeIdentifier::uninitialized(), "nullptr (uninitialized)")
 
constexpr const char * PREALLOCATED_OUTPUT_ARGNAME
 

Detailed Description

To make a c10 operator "C10Add" callable from caffe2 as "C2MyAddOpName", just write.

REGISTER_C10_OPERATOR_FOR_CAFFE2_DISPATCH(C10Add, C2MyAddOpName)

Variable Documentation

constexpr const char* caffe2::detail::PREALLOCATED_OUTPUT_ARGNAME
Initial value:
=
"_caffe2_preallocated_outputs"

Definition at line 11 of file c10_operator.h.