提交 2687f2af 编写于 作者: L lijianshe02 提交者: Tao Luo

fix input shape of test_log_loss_op (#21953)

上级 26a5d10e
...@@ -19,15 +19,19 @@ import numpy as np ...@@ -19,15 +19,19 @@ import numpy as np
from op_test import OpTest from op_test import OpTest
def sigmoid_array(x):
return 1 / (1 + np.exp(-x))
class TestLogLossOp(OpTest): class TestLogLossOp(OpTest):
def setUp(self): def setUp(self):
self.op_type = 'log_loss' self.op_type = 'log_loss'
samples_num = 32 samples_num = 100
predicted = np.random.uniform(0.1, 1.0, x = np.random.random((samples_num, 1)).astype("float32")
(samples_num, 1)).astype("float32") predicted = sigmoid_array(x)
labels = np.random.randint(0, 2, (samples_num, 1)).astype("float32") labels = np.random.randint(0, 2, (samples_num, 1)).astype("float32")
epsilon = 1e-4 epsilon = 1e-7
self.inputs = { self.inputs = {
'Predicted': predicted, 'Predicted': predicted,
'Labels': labels, 'Labels': labels,
......
...@@ -18,7 +18,7 @@ NOT_CHECK_OP_LIST = [ ...@@ -18,7 +18,7 @@ NOT_CHECK_OP_LIST = [
] ]
NEED_TO_FIX_OP_LIST = [ NEED_TO_FIX_OP_LIST = [
'sequence_scatter', 'log_loss', 'sequence_topk_avg_pooling', 'matmul', 'sequence_scatter', 'sequence_topk_avg_pooling', 'matmul',
'add_position_encoding', 'margin_rank_loss', 'elementwise_pow', 'add_position_encoding', 'margin_rank_loss', 'elementwise_pow',
'fused_elemwise_activation', 'mul' 'fused_elemwise_activation', 'mul'
] ]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册