Skip to content

Conversation

@zhiqiu
Copy link
Contributor

@zhiqiu zhiqiu commented Jul 2, 2021

PR types

Others

PR changes

OPs

Describe

Enhance error message when x or y is empty in elementwise_op

import paddle
import numpy as np
paddle.set_device('cpu')

weight_arr = np.array([], dtype=np.float32)
weight = paddle.to_tensor(np.reshape(weight_arr, (1, 8, 0)))

x_arr = np.array([], dtype=np.float32)
x = paddle.to_tensor(np.reshape(x_arr, (0, 0, 0)))

y_arr = np.array([], dtype=np.float32)
y = paddle.to_tensor(np.reshape(y_arr, (0, 0, 0)))

bce_loss = paddle.nn.BCELoss(weight, 'none')
bce_loss(x, y)

# ValueError: (InvalidArgument) The input X should not be empty

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jul 2, 2021

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@CLAassistant
Copy link

CLAassistant commented Jul 2, 2021

CLA assistant check
All committers have signed the CLA.

@zhiqiu zhiqiu force-pushed the dev/fix_elementwise_op branch from e44c7ab to e93e8de Compare July 2, 2021 03:44
@zhiqiu zhiqiu force-pushed the dev/fix_elementwise_op branch from e93e8de to 4c6c1fb Compare July 2, 2021 08:22
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Jul 2, 2021
@PaddlePaddle PaddlePaddle unlocked this conversation Jul 2, 2021
@zhiqiu zhiqiu merged commit 70100e4 into PaddlePaddle:develop Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants