Files
pytorch/caffe2/operators/weighted_multi_sampling_op.h
Sebastian Messmer a9395ce259 refactor caffe2 operator constructors - 9/9 (#17090)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17090

clangr codemod

Reviewed By: ezyang

Differential Revision: D14078550

fbshipit-source-id: 68e6de4298e55ce83039b7806c1a275c4d6593c8
2019-02-28 09:53:18 -08:00

27 lines
602 B
C++

#pragma once
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
namespace caffe2 {
template <class Context>
class WeightedMultiSamplingOp : public Operator<Context> {
public:
USE_OPERATOR_CONTEXT_FUNCTIONS;
template <class... Args>
explicit WeightedMultiSamplingOp(Args&&... args)
: Operator<Context>(std::forward<Args>(args)...),
num_samples_(
this->template GetSingleArgument<int64_t>("num_samples", 0)) {
CAFFE_ENFORCE_GE(num_samples_, 0);
}
bool RunOnDevice() override;
private:
const int64_t num_samples_;
};
} // namespace caffe2