Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the XXX_GRAD_CASE bug by HexToString #32004

Merged
merged 9 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions paddle/fluid/operators/expand_as_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ limitations under the License. */
}
#define REP_EXPAND_AS_TEMPLATE(n) BOOST_PP_REPEAT(n, EXPAND_AS_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))
#define EXPAND_AS_GRAD_CASE(n) \
case n: { \
ExpandAsBackward<n>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
#define EXPAND_AS_GRAD_CASE(n) \
case n + 1: { \
HexToString marked this conversation as resolved.
Show resolved Hide resolved
ExpandAsBackward<n + 1>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
}
#define EXPAND_AS_GRAD_TEMPLATE(z, n, data) \
BOOST_PP_IF(COND(n), EXPAND_AS_GRAD_CASE(n), )
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/operators/expand_as_v2_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ limitations under the License. */
}
#define REP_EXPAND_AS_TEMPLATE(n) BOOST_PP_REPEAT(n, EXPAND_AS_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))
#define EXPAND_AS_GRAD_CASE(n) \
case n: { \
ExpandAsBackward<n>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
#define EXPAND_AS_GRAD_CASE(n) \
case n + 1: { \
ExpandAsBackward<n + 1>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
}
#define EXPAND_AS_GRAD_TEMPLATE(z, n, data) \
BOOST_PP_IF(COND(n), EXPAND_AS_GRAD_CASE(n), )
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/operators/expand_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ limitations under the License. */
}
#define REP_EXPAND_TEMPLATE(n) BOOST_PP_REPEAT(n, EXPAND_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))
#define EXPAND_GRAD_CASE(n) \
case n: { \
ExpandBackward<n>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
#define EXPAND_GRAD_CASE(n) \
case n + 1: { \
ExpandBackward<n + 1>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
}
#define EXPAND_GRAD_TEMPLATE(z, n, data) \
BOOST_PP_IF(COND(n), EXPAND_GRAD_CASE(n), )
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/operators/expand_v2_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ limitations under the License. */
}
#define REP_EXPAND_TEMPLATE(n) BOOST_PP_REPEAT(n, EXPAND_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))
#define EXPAND_GRAD_CASE(n) \
case n: { \
ExpandBackward<n>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
#define EXPAND_GRAD_CASE(n) \
case n + 1: { \
ExpandBackward<n + 1>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
}
#define EXPAND_GRAD_TEMPLATE(z, n, data) \
BOOST_PP_IF(COND(n), EXPAND_GRAD_CASE(n), )
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/operators/meshgrid_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
#define REP_MESHGRID_TEMPLATE(n) BOOST_PP_REPEAT(n, MESHGRID_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))

#define MESHGRID_GRAD_CASE(n) \
case n: { \
MeshgridBackward<n>(context); \
break; \
#define MESHGRID_GRAD_CASE(n) \
case n + 1: { \
MeshgridBackward<n + 1>(context); \
break; \
}
#define MESHGRID_GRAD_TEMPLATE(z, n, data) \
BOOST_PP_IF(COND(n), MESHGRID_GRAD_CASE(n), )
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/operators/tile_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ limitations under the License. */
}
#define REP_TILE_TEMPLATE(n) BOOST_PP_REPEAT(n, TILE_TEMPLATE, ~)
#define COND(n) BOOST_PP_GREATER_EQUAL(n, BOOST_PP_MOD(n, MAX_RANK_SUPPORTED))
#define TILE_GRAD_CASE(n) \
case n: { \
TileBackward<n>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
#define TILE_GRAD_CASE(n) \
case n + 1: { \
TileBackward<n + 1>(context, reshape_dims_vec, reduce_dims_vec); \
break; \
}
#define TILE_GRAD_TEMPLATE(z, n, data) BOOST_PP_IF(COND(n), TILE_GRAD_CASE(n), )
#define REP_TILE_GRAD_TEMPLATE(n) BOOST_PP_REPEAT(n, TILE_GRAD_TEMPLATE, ~)
Expand Down