std::unique_ptr<WeightAccessor>(new WeightAccessor(filterData, filterShape)),
std::unique_ptr<BiasAccessor>(new BiasAccessor(biasData, biasShape)),
arm_compute::PadStrideInfo(stride_width, stride_height, padding_top, padding_bottom))
- << Tensor(
- std::unique_ptr<OutputAccessor>(new OutputAccessor(outputData, outputShape)));
+ ;
+ if (activation != static_cast<int32_t>(FusedActivationFunc::NONE)) {
+ arm_compute::ActivationLayerInfo::ActivationFunction actFunc =
+ arm_compute::ActivationLayerInfo::ActivationFunction::RELU;
+
+ graph << arm_compute::graph::ActivationLayer(arm_compute::ActivationLayerInfo(actFunc));
+ // Activation does not provide output Tensor and makes next layer fail to add to graph
+ // when it's the last(output) layer. To solve this, need to add a dummy layer.
+ uint32_t tso_c = getSizeOfDimension(outputShape, 0);
+ uint32_t tso_h = getSizeOfDimension(outputShape, 1);
+ uint32_t tso_w = getSizeOfDimension(outputShape, 2);
+ uint32_t tso_n = getSizeOfDimension(outputShape, 3);
+ graph << arm_compute::graph::ReshapeLayer(TensorShape(tso_w, tso_h, tso_c, tso_n));
+ }
+ graph << Tensor(std::unique_ptr<OutputAccessor>(new OutputAccessor(outputData, outputShape)))
;
graph.run();
int32_t padding_bottom = 0;
int32_t stride_width = 1;
int32_t stride_height = 1;
- int32_t activation = 0;
+ int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
float* outputData = new float[9];
const Shape outputShape = { OperandType::FLOAT32, {1,1,1,1}, 1.0, 0 };
float* expectData = new float[9];
int32_t padding_bottom = 1;
int32_t stride_width = 1;
int32_t stride_height = 1;
- int32_t activation = 0;
+ int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
float* outputData = new float[9];
const Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
float* expectData = new float[9];
int32_t padding_bottom = 1;
int32_t stride_width = 1;
int32_t stride_height = 1;
- int32_t activation = 0;
+ int32_t activation = static_cast<int32_t>(FusedActivationFunc::RELU);
float* outputData = new float[9];
const Shape outputShape = { OperandType::FLOAT32, {1,3,3,1}, 1.0, 0 };
float* expectData = new float[9];