summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Khatkevich <timk@fb.com>2019-01-30 03:43:48 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-01-30 03:54:11 -0800
commit7d7855ea3124c16862ea7ed4758f4c7a804ca1ac (patch)
treeee4ba8f62c58118ee7f3774e4d433625024e6f11
parent21907b6ba2a37afff8f23111b4f98a83fe2b093d (diff)
downloadpytorch-7d7855ea3124c16862ea7ed4758f4c7a804ca1ac.tar.gz
pytorch-7d7855ea3124c16862ea7ed4758f4c7a804ca1ac.tar.bz2
pytorch-7d7855ea3124c16862ea7ed4758f4c7a804ca1ac.zip
Fallback support for more operators (#16456)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16456 Adding fallbacks for more operators and fixing ifndef for expand_op.h Reviewed By: yinghai Differential Revision: D13845382 fbshipit-source-id: b7c5b7f7f176707b9ddffade139562a8085967ed
-rw-r--r--caffe2/ideep/operators/operator_fallback_ideep.cc45
-rw-r--r--caffe2/operators/expand_op.h4
2 files changed, 41 insertions, 8 deletions
diff --git a/caffe2/ideep/operators/operator_fallback_ideep.cc b/caffe2/ideep/operators/operator_fallback_ideep.cc
index bacb54687a..4169a2c1fb 100644
--- a/caffe2/ideep/operators/operator_fallback_ideep.cc
+++ b/caffe2/ideep/operators/operator_fallback_ideep.cc
@@ -2,8 +2,11 @@
#include <caffe2/ideep/utils/ideep_operator.h>
#include <caffe2/operators/accuracy_op.h>
+#include <caffe2/operators/affine_channel_op.h>
+#include <caffe2/operators/batch_matmul_op.h>
#include <caffe2/operators/bbox_transform_op.h>
#include <caffe2/operators/box_with_nms_limit_op.h>
+#include <caffe2/operators/clip_op.h>
#include <caffe2/operators/collect_and_distribute_fpn_rpn_proposals_op.h>
#include <caffe2/operators/conv_transpose_op.h>
#include <caffe2/operators/cross_entropy_op.h>
@@ -12,30 +15,32 @@
#include <caffe2/operators/distance_op.h>
#include <caffe2/operators/dropout_op.h>
#include <caffe2/operators/elementwise_add_op.h>
+#include <caffe2/operators/elementwise_div_op.h>
#include <caffe2/operators/elementwise_mul_op.h>
#include <caffe2/operators/elementwise_ops.h>
+#include <caffe2/operators/expand_op.h>
#include <caffe2/operators/filler_op.h>
#include <caffe2/operators/flatten_op.h>
#include <caffe2/operators/generate_proposals_op.h>
#include <caffe2/operators/given_tensor_fill_op.h>
#include <caffe2/operators/load_save_op.h>
#include <caffe2/operators/loss_op.h>
+#include <caffe2/operators/order_switch_ops.h>
#include <caffe2/operators/pad_op.h>
#include <caffe2/operators/prelu_op.h>
+#include <caffe2/operators/reduce_ops.h>
#include <caffe2/operators/roi_align_op.h>
#include <caffe2/operators/roi_align_rotated_op.h>
#include <caffe2/operators/scale_op.h>
#include <caffe2/operators/softmax_op.h>
+#include <caffe2/operators/softmax_with_loss_op.h>
+#include <caffe2/operators/stop_gradient.h>
#include <caffe2/operators/tanh_op.h>
+#include <caffe2/operators/tensor_protos_db_input.h>
#include <caffe2/operators/transpose_op.h>
-#include <caffe2/operators/affine_channel_op.h>
-#include <caffe2/operators/stop_gradient.h>
-#include <caffe2/operators/order_switch_ops.h>
-#include <caffe2/operators/softmax_with_loss_op.h>
+#include <caffe2/queue/queue_ops.h>
#include <caffe2/sgd/iter_op.h>
#include <caffe2/sgd/learning_rate_op.h>
-#include <caffe2/queue/queue_ops.h>
-#include <caffe2/operators/tensor_protos_db_input.h>
#ifdef CAFFE2_USE_GLOO
#include <caffe2/contrib/gloo/common_world_ops.h>
@@ -194,6 +199,34 @@ REGISTER_IDEEP_OPERATOR(
NCHW2NHWC,
IDEEPFallbackOp<NCHW2NHWCOp<float, CPUContext>>);
+REGISTER_IDEEP_OPERATOR(
+ Expand,
+ IDEEPFallbackOp<ExpandOp<
+ TensorTypes<std::int32_t, std::int64_t, float, double>,
+ CPUContext>>);
+
+REGISTER_IDEEP_OPERATOR(
+ ReduceL2,
+ IDEEPFallbackOp<
+ ReduceOp<TensorTypes<float>, CPUContext, L2Reducer<CPUContext>>>);
+REGISTER_IDEEP_OPERATOR(
+ ReduceSum,
+ IDEEPFallbackOp<ReduceOp<
+ TensorTypes<std::int32_t, std::int64_t, float, double>,
+ CPUContext,
+ SumReducer<CPUContext>>>);
+
+REGISTER_IDEEP_OPERATOR(
+ BatchMatMul,
+ IDEEPFallbackOp<BatchMatMulOp<CPUContext>>);
+
+REGISTER_IDEEP_OPERATOR(
+ Div,
+ IDEEPFallbackOp<
+ BinaryElementwiseOp<NumericTypes, CPUContext, DivFunctor<CPUContext>>>);
+
+REGISTER_IDEEP_OPERATOR(Clip, IDEEPFallbackOp<ClipOp<float, CPUContext>>);
+
#ifdef CAFFE2_USE_GLOO
namespace gloo {
// gloo operators
diff --git a/caffe2/operators/expand_op.h b/caffe2/operators/expand_op.h
index 30860baa13..5daffa55cf 100644
--- a/caffe2/operators/expand_op.h
+++ b/caffe2/operators/expand_op.h
@@ -1,5 +1,5 @@
-#ifndef CAFFE2_OPERATORS_REDUCE_OPS_H_
-#define CAFFE2_OPERATORS_REDUCE_OPS_H_
+#ifndef CAFFE2_OPERATORS_EXPAND_OP_H_
+#define CAFFE2_OPERATORS_EXPAND_OP_H_
#include <vector>