1 #include "smaug/core/backend.h"
3 #include "smaug/operators/eltwise_add_op.h"
17 dmaLoad(input0, input0, input_size *
sizeof(
float));
18 dmaLoad(input1, input1, input_size *
sizeof(
float));
20 for (
int i = 0; i < input_size; i++) {
21 results[i] = input0[i] + input1[i];
23 dmaStore(results, results, input_size *
sizeof(
float));
33 void EltwiseAddOp<ReferenceBackend>::run() {
34 auto input0 = getInput(Input0);
35 auto input1 = getInput(Input1);
36 auto output = getOutput(Outputs);
37 const TensorShape& input0Shape = input0->getShape();
38 const TensorShape& input1Shape = input1->getShape();
39 const TensorShape& outputShape = output->getShape();
40 assert(input0Shape == input1Shape && input0Shape == outputShape);
42 float* input0Data = input0->data<
float>();
43 float* input1Data = input1->data<
float>();
44 float* outputData = output->data<
float>();
46 input0Shape.storageSize() *
sizeof(
float));
48 input1Shape.storageSize() *
sizeof(
float));
50 outputShape.storageSize() *
sizeof(
float));
52 outputData, input0Shape.size());