354 lines
12 KiB
C
354 lines
12 KiB
C
#pragma once
|
|
|
|
#include "C_Tensor.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
// ArgMax, ArgMin
|
|
//------------------------------------------------------------------------
|
|
struct ArgMaxAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_ ;
|
|
int keepdims_ ; // unused
|
|
int select_last_index_; // added opset 12
|
|
};
|
|
typedef struct ArgMaxAttribute ArgMaxAttribute;
|
|
typedef struct ArgMaxAttribute ArgMinAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Concat
|
|
//------------------------------------------------------------------------
|
|
struct ConcatAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
};
|
|
typedef struct ConcatAttribute ConcatAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// BatchNormalization
|
|
//------------------------------------------------------------------------
|
|
struct BatchNormalizationAttribute{
|
|
// user
|
|
const char* name_;
|
|
float epsilon_; // value to avoid 0 division
|
|
float momentum_; // variable factor
|
|
};
|
|
typedef struct BatchNormalizationAttribute BatchNormalizationAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// CenterCropPad
|
|
//------------------------------------------------------------------------
|
|
struct CenterCropPadAttribute {
|
|
// user
|
|
const char* name_;
|
|
C_Shape axes_;
|
|
};
|
|
typedef struct CenterCropPadAttribute CenterCropPadAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Compress
|
|
//------------------------------------------------------------------------
|
|
struct CompressAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
bool axis_set_;
|
|
};
|
|
typedef struct CompressAttribute CompressAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// CumSum
|
|
//------------------------------------------------------------------------
|
|
struct CumSumAttribute{
|
|
// user
|
|
const char* name_;
|
|
int exclusive_;
|
|
int reverse_;
|
|
};
|
|
typedef struct CumSumAttribute CumSumAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Det
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute DetAttribute;
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
// DequantizeLinear
|
|
//------------------------------------------------------------------------
|
|
struct DequantizeLinearAttribute{
|
|
// user
|
|
const char* name_;
|
|
int axis_; // optional, added opset 13
|
|
};
|
|
typedef struct DequantizeLinearAttribute DequantizeLinearAttribute;
|
|
|
|
//------------------------------------------------------------------
|
|
// Einsum
|
|
//-----------------------------------------------------------------------
|
|
struct EinsumAttribute {
|
|
// user
|
|
const char* name_;
|
|
const char* equation_;
|
|
};
|
|
typedef struct EinsumAttribute EinsumAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Expand
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute ExpandAttribute;
|
|
|
|
//------------------------------------------------------------------------
|
|
// EyeLike
|
|
//------------------------------------------------------------------------
|
|
struct EyeLikeAttribute{
|
|
// user
|
|
const char* name_;
|
|
int dtype_; // optional, unused
|
|
int k_;
|
|
};
|
|
typedef struct EyeLikeAttribute EyeLikeAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// GridSample
|
|
//------------------------------------------------------------------------
|
|
struct GridSampleAttribute{
|
|
// user
|
|
const char* name_;
|
|
int align_corners_;
|
|
const char* mode_;
|
|
const char* padding_mode_;
|
|
};
|
|
typedef struct GridSampleAttribute GridSampleAttribute;
|
|
//------------------------------------------------------------------------
|
|
// GroupNormalization
|
|
//------------------------------------------------------------------------
|
|
struct GroupNormalizationAttribute{
|
|
// user
|
|
const char* name_;
|
|
float epsilon_; // value to avoid 0 division
|
|
int num_groups_;
|
|
};
|
|
typedef struct GroupNormalizationAttribute GroupNormalizationAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Hardmax
|
|
//------------------------------------------------------------------------
|
|
struct HardmaxAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
};
|
|
typedef struct HardmaxAttribute HardmaxAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// InstanceNormalization
|
|
//------------------------------------------------------------------------
|
|
struct InstanceNormalizationAttribute {
|
|
// user
|
|
const char* name_;
|
|
float epsilon_;
|
|
};
|
|
typedef struct InstanceNormalizationAttribute InstanceNormalizationAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// LpNorm
|
|
//------------------------------------------------------------------------
|
|
struct LpNormalizationAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
int p_;
|
|
};
|
|
typedef struct LpNormalizationAttribute LpNormalizationAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// LRN
|
|
//------------------------------------------------------------------------
|
|
struct LRNAttribute {
|
|
// user
|
|
const char* name_;
|
|
float alpha_; // scaling parameter
|
|
float beta_; // exponent
|
|
float bias_; // bias
|
|
int size_; // number of local channels
|
|
};
|
|
typedef struct LRNAttribute LRNAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// LayerNormalization
|
|
//------------------------------------------------------------------------
|
|
struct LayerNormalizationAttribute{
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
float epsilon_;
|
|
int stash_type_;
|
|
};
|
|
typedef struct LayerNormalizationAttribute LayerNormalizationAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Mean
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute MeanAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// MelWeightMatrix
|
|
//------------------------------------------------------------------------
|
|
struct MelWeightMatrixAttribute{
|
|
// user
|
|
const char* name_;
|
|
int output_datatype_;
|
|
};
|
|
typedef struct MelWeightMatrixAttribute MelWeightMatrixAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// NonMaxSuppression
|
|
//------------------------------------------------------------------------
|
|
struct NonMaxSuppressionAttribute {
|
|
// user
|
|
const char* name_;
|
|
int center_point_box_;
|
|
};
|
|
typedef struct NonMaxSuppressionAttribute NonMaxSuppressionAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// NegativeLogLikelihoodLoss
|
|
//------------------------------------------------------------------------
|
|
struct NegativeLogLikelihoodLossAttribute {
|
|
//user
|
|
const char* name_;
|
|
int ignore_index_;
|
|
const char* reduction_;
|
|
};
|
|
typedef struct NegativeLogLikelihoodLossAttribute NegativeLogLikelihoodLossAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Nonzero
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute NonzeroAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// OneHot
|
|
//------------------------------------------------------------------------
|
|
struct OneHotAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
};
|
|
typedef struct OneHotAttribute OneHotAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// PRelu
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute PReluAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// ReverseSequence
|
|
//------------------------------------------------------------------------
|
|
struct ReverseSequenceAttribute {
|
|
// user
|
|
const char* name_;
|
|
uint32_t batch_axis_;
|
|
uint32_t time_axis_;
|
|
|
|
// library
|
|
uint32_t seq_lens_size_;
|
|
uint32_t seq_lens_max_;
|
|
int32_t strides_[2];
|
|
};
|
|
typedef struct ReverseSequenceAttribute ReverseSequenceAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// RoiAlign
|
|
//------------------------------------------------------------------------
|
|
struct RoiAlignAttribute {
|
|
// user
|
|
const char* name_;
|
|
const char *mode_;
|
|
const char *coordinate_transformation_mode_;
|
|
int output_height_;
|
|
int output_width_;
|
|
int sampling_ratio_;
|
|
float spatial_scale_;
|
|
|
|
// library
|
|
int num_rois_;
|
|
int channels_;
|
|
};
|
|
typedef struct RoiAlignAttribute RoiAlignAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Slice
|
|
//------------------------------------------------------------------------
|
|
struct SliceAttribute {
|
|
// user
|
|
const char* name_;
|
|
C_Shape start_index_;
|
|
C_Shape end_index_;
|
|
C_Shape input_low_dim_size_;
|
|
C_Shape output_low_dim_size_;
|
|
C_Shape steps_;
|
|
};
|
|
typedef struct SliceAttribute SliceAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Softmax
|
|
//------------------------------------------------------------------------
|
|
struct SoftmaxAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
};
|
|
typedef struct SoftmaxAttribute SoftmaxAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// LogSoftmax
|
|
//------------------------------------------------------------------------
|
|
struct LogSoftmaxAttribute {
|
|
// user
|
|
const char* name_;
|
|
int axis_;
|
|
};
|
|
typedef struct LogSoftmaxAttribute LogSoftmaxAttribute;
|
|
//----------------------------------------------------------------------------
|
|
// Tile
|
|
//------------------------------------------------------------------------
|
|
typedef struct Attribute TileAttribute;
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Transpose
|
|
//------------------------------------------------------------------------
|
|
struct TransposeAttribute {
|
|
// user
|
|
const char* name_;
|
|
C_Shape perm_; // permutation of axes
|
|
};
|
|
typedef struct TransposeAttribute TransposeAttribute;
|
|
|
|
|
|
CREATE_DECL_RUN_FUN(ArgMax)
|
|
CREATE_DECL_RUN_FUN(ArgMin)
|
|
CREATE_DECL_RUN_FUN(BatchNormalization)
|
|
CREATE_DECL_RUN_FUN(CenterCropPad)
|
|
CREATE_DECL_RUN_FUN(Concat)
|
|
CREATE_DECL_RUN_FUN(Compress)
|
|
CREATE_DECL_RUN_FUN(CumSum)
|
|
CREATE_DECL_RUN_FUN(Det)
|
|
CREATE_DECL_RUN_FUN(DequantizeLinear)
|
|
CREATE_DECL_RUN_FUN(Einsum)
|
|
CREATE_DECL_RUN_FUN(Expand)
|
|
CREATE_DECL_RUN_FUN(EyeLike)
|
|
CREATE_DECL_RUN_FUN(GridSample)
|
|
CREATE_DECL_RUN_FUN(GroupNormalization)
|
|
CREATE_DECL_RUN_FUN(Hardmax)
|
|
CREATE_DECL_RUN_FUN(InstanceNormalization)
|
|
CREATE_DECL_RUN_FUN(LRN)
|
|
CREATE_DECL_RUN_FUN(LpNormalization)
|
|
CREATE_DECL_RUN_FUN(MelWeightMatrix)
|
|
CREATE_DECL_RUN_FUN(Mean)
|
|
CREATE_DECL_RUN_FUN(NegativeLogLikelihoodLoss)
|
|
CREATE_DECL_RUN_FUN(NonMaxSuppression)
|
|
CREATE_DECL_RUN_FUN(Nonzero)
|
|
CREATE_DECL_RUN_FUN(OneHot)
|
|
CREATE_DECL_RUN_FUN(PRelu)
|
|
CREATE_DECL_RUN_FUN(ReverseSequence)
|
|
CREATE_DECL_RUN_FUN(RoiAlign)
|
|
CREATE_DECL_RUN_FUN(Slice)
|
|
CREATE_DECL_RUN_FUN(Softmax)
|
|
CREATE_DECL_RUN_FUN(LogSoftmax)
|
|
CREATE_DECL_RUN_FUN(Tile)
|
|
CREATE_DECL_RUN_FUN(Transpose)
|
|
CREATE_DECL_RUN_FUN(LayerNormalization)
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |