1 #include "caffe2/mobile/contrib/arm-compute/core/context.h" 2 #include "caffe2/mobile/contrib/arm-compute/core/operator.h" 4 #include "caffe2/mobile/contrib/arm-compute/operators/activation_ops.h" 5 #include "caffe2/operators/relu_op.h" 10 bool GLReluOp<T>::RunOnDevice() {
12 auto *Xblob = OperatorBase::Inputs()[0];
14 X_ = GLContext::getGLTensor<T>(Xblob);
18 OperatorBase::Outputs()[0]->template GetMutable<GLTensor<T>>();
22 if (Y->get_underlying() != X_->get_underlying())
26 relu_layer_.configure(
27 X_->get_underlying(), Y->get_underlying(),
28 arm_compute::ActivationLayerInfo(
29 arm_compute::ActivationLayerInfo::ActivationFunction::RELU));
32 X_->lazy_allocate(Xblob, second_run_,
true);
36 if (Y->get_underlying() != X_->get_underlying())
47 REGISTER_GL_OPERATOR(Relu, GLReluOp<half>);
50 bool GLSigmoidOp<T>::RunOnDevice() {
52 auto *Xblob = OperatorBase::Inputs()[0];
54 X_ = GLContext::getGLTensor<T>(Xblob);
58 OperatorBase::Outputs()[0]->template GetMutable<GLTensor<T>>();
62 if (Y->get_underlying() != X_->get_underlying())
67 sigmoid_layer_.configure(
68 X_->get_underlying(), Y->get_underlying(),
69 arm_compute::ActivationLayerInfo(
70 arm_compute::ActivationLayerInfo::ActivationFunction::LOGISTIC));
72 X_->lazy_allocate(Xblob, second_run_,
true);
76 if (Y->get_underlying() != X_->get_underlying())
87 REGISTER_GL_OPERATOR(Sigmoid, GLSigmoidOp<DataType>);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...