[pyper] Use Caffe2 ops
Summary: Replace inefficient python code w/ calls to Caffe2 operators
Test Plan: existing unit tests for modified operators
Reviewed By: alyssawangqq
Differential Revision: D21270962
fbshipit-source-id: cb11133be4eff80a24d1358fd7bb7d354075dd8b
diff --git a/caffe2/operators/utility_ops.cc b/caffe2/operators/utility_ops.cc
index 9b0ad56..b23256f 100644
--- a/caffe2/operators/utility_ops.cc
+++ b/caffe2/operators/utility_ops.cc
@@ -1068,3 +1068,8 @@
SHOULD_NOT_DO_GRADIENT(Fail);
} // namespace caffe2
+
+C10_EXPORT_CAFFE2_OP_TO_C10_CPU(
+ GatherRanges,
+ "_caffe2::GatherRanges(Tensor data, Tensor ranges) -> (Tensor, Tensor)",
+ caffe2::GatherRangesOp<caffe2::CPUContext>)
diff --git a/caffe2/operators/utility_ops.h b/caffe2/operators/utility_ops.h
index efe4b17..b5f1b29 100644
--- a/caffe2/operators/utility_ops.h
+++ b/caffe2/operators/utility_ops.h
@@ -7,6 +7,7 @@
#include "caffe2/core/common_omp.h"
#include "caffe2/core/context.h"
+#include "caffe2/core/export_caffe2_op_to_c10.h"
#include "caffe2/core/logging.h"
#include "caffe2/core/operator.h"
#include "caffe2/core/types.h"
@@ -14,6 +15,8 @@
#include "caffe2/utils/conversions.h"
#include "caffe2/utils/math.h"
+C10_DECLARE_EXPORT_CAFFE2_OP_TO_C10(GatherRangesOp);
+
namespace caffe2 {
template <class Context>