|
|
@ -83,9 +83,11 @@ class TestSoftmaxOpError(OpTest):
|
|
|
|
x1 = fluid.create_lod_tensor(
|
|
|
|
x1 = fluid.create_lod_tensor(
|
|
|
|
np.array([[-1]]), [[1]], fluid.CPUPlace())
|
|
|
|
np.array([[-1]]), [[1]], fluid.CPUPlace())
|
|
|
|
self.assertRaises(TypeError, fluid.layers.softmax, x1)
|
|
|
|
self.assertRaises(TypeError, fluid.layers.softmax, x1)
|
|
|
|
# The input dtype of softmax_op must be float32 or float64.
|
|
|
|
# The input dtype of softmax_op must be float16, float32 or float64.
|
|
|
|
x2 = fluid.layers.data(name='x2', shape=[4], dtype="int32")
|
|
|
|
x2 = fluid.layers.data(name='x2', shape=[4], dtype="int32")
|
|
|
|
self.assertRaises(TypeError, fluid.layers.softmax, x2)
|
|
|
|
self.assertRaises(TypeError, fluid.layers.softmax, x2)
|
|
|
|
|
|
|
|
x3 = fluid.layers.data(name='x3', shape=[4], dtype="float16")
|
|
|
|
|
|
|
|
fluid.layers.softmax(x3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestSoftmaxOp2(TestSoftmaxOp):
|
|
|
|
class TestSoftmaxOp2(TestSoftmaxOp):
|
|
|
|