Fix deprecation message from GatherV2Grad
This PR tries to fix the issue in 39701 where there are deprecation message from GatherV2Grad: ``` WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/tensorflow/python/ops/array_grad.py:644: _EagerTensorBase.cpu (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.identity instead. ``` This PR fixes the message and use array_ops.identity instead (as was suggested by message). This PR fixes 39701. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
ae76544efc
commit
4aecaf3771
@ -641,7 +641,7 @@ def _GatherV2Grad(op, grad):
|
||||
# For axis 0 gathers, build an appropriately shaped IndexedSlices.
|
||||
if axis_static == 0:
|
||||
if context.executing_eagerly():
|
||||
params_tail_shape = params_shape.cpu()[1:]
|
||||
params_tail_shape = array_ops.identity(params_shape)[1:]
|
||||
else:
|
||||
params_tail_shape = params_shape[1:]
|
||||
values_shape = array_ops.concat([indices_size, params_tail_shape], 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user