MulAdd implemented

This commit is contained in:
Francesco Gatti
2017-06-29 10:06:49 +00:00
parent 97226cbc78
commit cc99347560
6 changed files with 82 additions and 5 deletions
+18
View File
@@ -191,5 +191,23 @@ protected:
value_type *dstData; //where results will be putted
};
/**
MulAdd layer
apply a multiplication and then an addition for each data
*/
class MulAdd : public Layer {
public:
MulAdd(Network *net, dataDim_t input_dim, value_type mul, value_type add);
virtual ~MulAdd();
value_type* infer(dataDim_t &dim, value_type* srcData);
protected:
value_type mul, add;
value_type *dstData, *add_vector; //where results will be putted
};
}
#endif //LAYER_H
+3
View File
@@ -65,6 +65,9 @@
void readBinaryFile(const char* fname, int size, value_type** data_h, value_type** data_d);
void printDeviceVector(int size, value_type* vec_d);
void resize(int size, value_type **data);
void matrixTranspose(cublasHandle_t handle, value_type* srcData, value_type* dstData, int rows, int cols);
void matrixMulAdd( cublasHandle_t handle, value_type* srcData, value_type* dstData,
value_type* add_vector, int dim, value_type mul);
#endif //UTILS_H