|
|
@ -42,10 +42,13 @@ class TestSignOpError(OpTest):
|
|
|
|
# The input type of sign_op must be Variable or numpy.ndarray.
|
|
|
|
# The input type of sign_op must be Variable or numpy.ndarray.
|
|
|
|
input1 = 12
|
|
|
|
input1 = 12
|
|
|
|
self.assertRaises(TypeError, fluid.layers.sign, input1)
|
|
|
|
self.assertRaises(TypeError, fluid.layers.sign, input1)
|
|
|
|
# The input dtype of sign_op must be float32, float64.
|
|
|
|
# The input dtype of sign_op must be float16, float32, float64.
|
|
|
|
input2 = fluid.layers.data(
|
|
|
|
input2 = fluid.layers.data(
|
|
|
|
name='input2', shape=[12, 10], dtype="int32")
|
|
|
|
name='input2', shape=[12, 10], dtype="int32")
|
|
|
|
self.assertRaises(TypeError, fluid.layers.sign, input2)
|
|
|
|
self.assertRaises(TypeError, fluid.layers.sign, input2)
|
|
|
|
|
|
|
|
input3 = fluid.layers.data(
|
|
|
|
|
|
|
|
name='input3', shape=[4], dtype="float16")
|
|
|
|
|
|
|
|
fluid.layers.sign(input3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|