SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
|
1 #include "smaug/core/backend.h"
3 #include "smaug/operators/relu_op.h"
4 #include "smaug/operators/ref/ref_activation_fun_op.h"
9 void ReluOp<ReferenceBackend>::run() {
10 auto inputs = getInput(Inputs);
11 auto outputs = getOutput(Outputs);
12 assert(inputs->getShape() == outputs->getShape());
13 float* inputData = inputs->data<
float>();
14 float* outputData = outputs->data<
float>();
16 inputs->getShape().storageSize() *
sizeof(
float));
18 inputs->getShape().storageSize() *
sizeof(
float));
20 slope == 0 ? activation_type::RELU : activation_type::LRELU;
24 outputData, inputs->getShape().size(),
function, params);
enum _activation_type activation_type
The activation function to apply to an operator's output in hardware.
void ref_activation_fun_nc(float *inputs, float *results, int inputs_size, activation_type function, activation_param_t params)
Top level entry point for all Reference activation functions.
Parameters to the activation function hardware.
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Utilities for writing and invoking Aladdin kernels from Operators.
void mapArrayToAccel(unsigned reqCode, const char *arrayName, void *baseAddr, size_t size)
Maps an array of data to the accelerator.
void invokeKernel(int accelIdx, unsigned reqCode, const Kernel &kernel, Args &&... args)
The generic blocking interface for all accelerator kernel functions.