1 #include "caffe2/mobile/contrib/arm-compute/core/context.h" 2 #include "caffe2/mobile/contrib/arm-compute/core/operator.h" 3 #include "caffe2/operators/resize_op.h" 13 width_scale_ =
static_cast<float>(
14 OperatorBase::GetSingleArgument<float>(
"width_scale", 1));
17 height_scale_ =
static_cast<float>(
18 OperatorBase::GetSingleArgument<float>(
"height_scale", 1));
20 CAFFE_ENFORCE_GT(width_scale_, 0);
21 CAFFE_ENFORCE_GT(height_scale_, 0);
25 bool RunOnDevice()
override;
29 arm_compute::GCScale resize_layer_;
30 bool first_run_ =
true, second_run_ =
true;
31 GLContext::deleted_unique_ptr<const GLTensor<T>> X_;
37 auto* Xblob = OperatorBase::Inputs()[0];
40 X_ = GLContext::getGLTensor<T>(Xblob);
43 auto N = X_->dim32(0);
44 auto C = X_->dim32(1);
45 auto H = X_->dim32(2);
46 auto W = X_->dim32(3);
49 OperatorBase::Outputs()[0]->template GetMutable<GLTensor<T>>();
51 vector<TIndex> output_dims = {N, C, H * height_scale_, W * width_scale_};
52 Y->Resize(output_dims);
54 resize_layer_.configure(X_->get_underlying(), Y->get_underlying(), arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR, arm_compute::BorderMode::UNDEFINED);
56 X_->lazy_allocate(Xblob, second_run_,
true);
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
bool HasArgument(const string &name) const
Checks if the operator has an argument of the given name.