Skip to content

Commit

Permalink
revert remove simple op (apache#3501)
Browse files Browse the repository at this point in the history
deprecate
  • Loading branch information
piiswrong committed Dec 29, 2016
1 parent feb2daa commit db905c4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion include/mxnet/operator_util.h
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2015 by Contributors
* \file operator_util.h
* \brief Utility functions and registries to help quickly build new operators.
*
* [Deprecated]
* Use the register functions in this file when possible to simplify operator creations.
* Operators registered in this file will be exposed to both NDArray API and symbolic API.
*
Expand All @@ -11,6 +11,10 @@
#ifndef MXNET_OPERATOR_UTIL_H_
#define MXNET_OPERATOR_UTIL_H_

#ifdef _MSC_VER
#pragma warning(disable:4503) // disable warning: decorated name length exceeded.
#endif

#include <dmlc/registry.h>
#include <dmlc/parameter.h>
#include <map>
Expand Down Expand Up @@ -451,6 +455,32 @@ class SimpleOpRegistry {
*/
#define MXNET_SPECIAL_MAX_NDIM 5


//--------------------------------------------------------------
// The following part are API Registration of Simple Operators
//--------------------------------------------------------------
/*!
* \brief Macro to register simple operator to both imperative and symbolic API.
*
* see src/operator/elementwise_unary_op-inl.h for example
*
* \code
* // example of registering a sigmoid operator on GPU
* // MySigmoid is of type UnaryFunction,
* // MySigmoidGrad is of type UnaryGradFunctionT2
*
* MXNET_REGISTER_SIMPLE_OP(sigmoid, cpu)
* .set_function(MySigmoid<gpu>, true)
* .set_gradient(MySigmoidGrad<gpu>, true)
* .describe("Sigmoid function");
*
* \endcode
*/
#define MXNET_REGISTER_SIMPLE_OP(Name, DEV) \
static ::mxnet::op::SimpleOpRegEntry & \
__make_ ## SimpleOpRegEntry ## _ ## Name ## __ ## DEV ##__ = \
::mxnet::op::SimpleOpRegistry::Get()->__REGISTER_OR_FIND__(#Name)

} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_UTIL_H_

0 comments on commit db905c4

Please sign in to comment.