|
|
|
@ -18,6 +18,8 @@ import unittest
|
|
|
|
|
import paddle.fluid.layers as layers
|
|
|
|
|
from paddle.fluid.executor import Executor
|
|
|
|
|
import paddle.fluid.core as core
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
from paddle.fluid import compiler, Program, program_guard
|
|
|
|
|
import numpy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -33,5 +35,14 @@ class TestLoDArrayLength(unittest.TestCase):
|
|
|
|
|
self.assertEqual(11, result[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestLoDArrayLengthOpError(unittest.TestCase):
|
|
|
|
|
def test_errors(self):
|
|
|
|
|
with program_guard(Program(), Program()):
|
|
|
|
|
#for ci coverage
|
|
|
|
|
x1 = numpy.random.randn(2, 4).astype('int32')
|
|
|
|
|
|
|
|
|
|
self.assertRaises(TypeError, fluid.layers.array_length, array=x1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|
|
|
|
|