提交 97de8813 编写于 作者: Y yangyaming

Fix type for unit test of huber_loss_op.

上级 cb0118f3
...@@ -21,7 +21,8 @@ class TestHuberLossOp(OpTest): ...@@ -21,7 +21,8 @@ class TestHuberLossOp(OpTest):
'Y': np.random.uniform(0, 1., (samples_num, 1)).astype('float32'), 'Y': np.random.uniform(0, 1., (samples_num, 1)).astype('float32'),
} }
residual = self.inputs['Y'] - self.inputs['X'] residual = self.inputs['Y'] - self.inputs['X']
loss = np.vectorize(huber_loss_forward)(residual, delta) loss = np.vectorize(huber_loss_forward)(residual,
delta).astype('float32')
self.attrs = {'delta': delta} self.attrs = {'delta': delta}
self.outputs = { self.outputs = {
'Residual': residual, 'Residual': residual,
...@@ -43,6 +44,5 @@ class TestHuberLossOp(OpTest): ...@@ -43,6 +44,5 @@ class TestHuberLossOp(OpTest):
['X'], 'Out', max_relative_error=0.008, no_grad_set=set('residual')) ['X'], 'Out', max_relative_error=0.008, no_grad_set=set('residual'))
# TODO(typhoonzero): should add this back till we fix it if __name__ == '__main__':
#if __name__ == '__main__': unittest.main()
# unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册