66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
//
|
|
// Created by xiangzhou on 11/9/23.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include "C_Tensor.h"
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <math.h>
|
|
typedef float (*opfn)(const float x, const float y);
|
|
|
|
struct ElementBinaryOpAttribute {
|
|
// user - only one of the two needs to be provided
|
|
const char* name_;
|
|
opfn fn_;
|
|
const char* direction_; // bitshift: "LEFT" or "RIGHT"
|
|
};
|
|
typedef struct ElementBinaryOpAttribute ElementBinaryOpAttribute;
|
|
|
|
void ElementBinaryOperator_Run(const C_Tensors* inputs,
|
|
const C_Tensors* weights,
|
|
C_Tensors* outputs,
|
|
const ElementBinaryOpAttribute* p_attr);
|
|
|
|
float add_fn(const float x, const float y);
|
|
|
|
float sub_fn(const float x, const float y);
|
|
|
|
float mul_fn(const float x, const float y);
|
|
|
|
float div_fn(const float x, const float y) ;
|
|
|
|
float max_fn(const float x, const float y) ;
|
|
|
|
float min_fn(const float x, const float y) ;
|
|
|
|
float less_fn(const float x, const float y) ;
|
|
|
|
float greater_fn(const float x, const float y);
|
|
|
|
float greater_or_equal_fn(const float x, const float y);
|
|
|
|
float equal_fn(const float x, const float y) ;
|
|
|
|
float and_fn(const float x, const float y);
|
|
|
|
float or_fn(const float x, const float y);
|
|
|
|
float bitwise_and_fn(const float x, const float y);
|
|
|
|
float bitwise_or_fn(const float x, const float y);
|
|
|
|
float bitwise_xor_fn(const float x, const float y);
|
|
|
|
float mod_fn(const float x, const float y);
|
|
|
|
float pow_fn(const float x, const float y);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |