From b00cae60abdea7402baf70798885f9634b8eb0b0 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Wed, 7 Feb 2018 10:59:21 +0800 Subject: [PATCH] refine code --- python/paddle/v2/fluid/executor.py | 3 +-- python/paddle/v2/fluid/tests/test_cpp_reader.py | 13 ++----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/python/paddle/v2/fluid/executor.py b/python/paddle/v2/fluid/executor.py index 1bc3423f10c..0eddcc3a5ab 100644 --- a/python/paddle/v2/fluid/executor.py +++ b/python/paddle/v2/fluid/executor.py @@ -51,8 +51,7 @@ def as_numpy(tensor): if len(lod) == 0: ans = tensor_data else: - #raise RuntimeError("LoD Calculate lacks unit tests and buggy") - ans = tensor_data + raise RuntimeError("LoD Calculate lacks unit tests and buggy") # elif len(lod) == 1: # ans = [] # idx = 0 diff --git a/python/paddle/v2/fluid/tests/test_cpp_reader.py b/python/paddle/v2/fluid/tests/test_cpp_reader.py index cd5fff9425c..7efcb0c46d2 100644 --- a/python/paddle/v2/fluid/tests/test_cpp_reader.py +++ b/python/paddle/v2/fluid/tests/test_cpp_reader.py @@ -33,16 +33,6 @@ create_random_reader_op = block.append_op( "max": 1.0 }) -batch_reader = block.create_var( - type=fluid.core.VarDesc.VarType.READER, name=("BatchReader")) -batch_reader.desc.set_lod_levels([0, 0]) - -create_batch_reader_op = block.append_op( - type="create_batch_reader", - inputs={"UnderlyingReader": random_reader}, - outputs={"Out": batch_reader}, - attrs={"batch_size": 10}) - out1 = block.create_var( type=fluid.core.VarDesc.VarType.LOD_TENSOR, name="Out1", @@ -57,7 +47,8 @@ out2 = block.create_var( lod_level=1) read_op = block.append_op( - type="read", inputs={"Reader": batch_reader}, + type="read", + inputs={"Reader": random_reader}, outputs={"Out": [out1, out2]}) place = fluid.CPUPlace() -- GitLab