diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index d3bb59a5ff71a7b919f26174bab6788ff987841f..f35dbf66ad015e8648b93fd8f00f8955a91497e1 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -7660,8 +7660,7 @@ def lod_reset(x, y=None, target_lod=None): out = helper.create_variable_for_type_inference(dtype=x.dtype) if y is not None: check_type(y, 'y', (Variable), 'lod_reset') - if y.lod_level == 0: - check_variable_and_dtype(y, 'y', ['int32'], 'lod_reset') + #TODO: check y.lod_level = 0 dtype helper.append_op( type="lod_reset", inputs={'X': x, 'Y': y}, outputs={'Out': out}) @@ -7732,8 +7731,7 @@ def lod_append(x, level): if isinstance(level, Variable): inputs['Y'] = level - if level.lod_level == 0: - check_variable_and_dtype(level, 'level', ['int32'], 'lod_append') + #TODO: check y.lod_level = 0 dtype else: attrs['target_lod'] = level helper.append_op( diff --git a/python/paddle/fluid/tests/unittests/test_lod_append_op.py b/python/paddle/fluid/tests/unittests/test_lod_append_op.py index 82cf4318098b6b834e7e41337a89542cd7d7e088..806880bdce09e463f0dc82ab9396b74c3e63b469 100644 --- a/python/paddle/fluid/tests/unittests/test_lod_append_op.py +++ b/python/paddle/fluid/tests/unittests/test_lod_append_op.py @@ -67,14 +67,6 @@ class TestLodAppendOpError(unittest.TestCase): name='level3' + dtype, shape=[4], dtype='int32', lod_level=2) self.assertRaises(TypeError, fluid.layers.lod_append, x3, level3) - # Input(level) dtype must be int32 when lod_level=0 - for dtype in ["bool", "float16", "float32", "float64", "int64"]: - x4 = fluid.layers.data( - name='x4' + dtype, shape=[4], dtype='float32') - level4 = fluid.layers.data( - name='level4_' + dtype, shape=[4], dtype=dtype, lod_level=0) - self.assertRaises(TypeError, fluid.layers.lod_append, x4, level4) - if __name__ == "__main__": unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_lod_reset_op.py b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py index ac2cd1be27f46351bc965d82f0603f463f775564..1fa172cf0312df5bfb8844cf8a0718dd468d3d33 100644 --- a/python/paddle/fluid/tests/unittests/test_lod_reset_op.py +++ b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py @@ -150,14 +150,6 @@ class TestLodResetOpError(unittest.TestCase): name='y2' + dtype, shape=[4], dtype='int32', lod_level=2) self.assertRaises(TypeError, fluid.layers.lod_reset, x2, y2) - # Input(y) dtype must be int32 when lod_level=0 - for dtype in ["bool", "float16", "float32", "float64", "int64"]: - x3 = fluid.layers.data( - name='x3' + dtype, shape=[4], dtype='float32') - y3 = fluid.layers.data( - name='y3' + dtype, shape=[4], dtype=dtype, lod_level=0) - self.assertRaises(TypeError, fluid.layers.lod_reset, x3, y3) - if __name__ == '__main__': unittest.main()