From f6f06924512553e4cc8c8eb299730565dc297006 Mon Sep 17 00:00:00 2001 From: Xin Pan Date: Mon, 26 Nov 2018 19:07:17 +0800 Subject: [PATCH] clean up test=develop --- paddle/fluid/pybind/pybind.cc | 1 - python/paddle/fluid/framework.py | 8 ++------ python/paddle/fluid/imperative/layers.py | 2 +- python/paddle/fluid/layer_helper.py | 7 ------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 03fe1402c..3cf1ec34a 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -159,7 +159,6 @@ PYBIND11_MODULE(core, m) { self.mutable_data(place); }) .def("set", PyCPUTensorSetFromArray) - .def("set_float", PyCPUTensorSetFromArray) .def("set", PyCPUTensorSetFromArray) .def("set", PyCPUTensorSetFromArray) .def("set", PyCPUTensorSetFromArray) diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 235d692af..3d3263e7c 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -283,15 +283,11 @@ class Variable(core.VariableBase): name = unique_name.generate('_generated_var') is_new_var = False name = cpt.to_text(name) - desc = self.block.desc.find_var(cpt.to_bytes(name)) + self.desc = self.block.desc.find_var(cpt.to_bytes(name)) - if desc is None: - # sys.stderr.write('desc is None\n') + if self.desc is None: self.desc = self.block.desc.var(cpt.to_bytes(name)) is_new_var = True - else: - # sys.stderr.write('found var %s %s' % (name, self.desc)) - self.desc = desc if is_new_var: self.desc.set_type(type) diff --git a/python/paddle/fluid/imperative/layers.py b/python/paddle/fluid/imperative/layers.py index 32928347a..15f693984 100644 --- a/python/paddle/fluid/imperative/layers.py +++ b/python/paddle/fluid/imperative/layers.py @@ -54,7 +54,7 @@ class PyLayer(core.Layer): dtype=x.dtype) var = self._scope.var(py_var.name) tensor = var.get_tensor() - tensor.set_float(x, core.CPUPlace()) + tensor.set(x, core.CPUPlace()) var_inputs.append(py_var) elif isinstance(x, framework.Variable): var_inputs.append(x) diff --git a/python/paddle/fluid/layer_helper.py b/python/paddle/fluid/layer_helper.py index ceabb5221..ca531f3be 100644 --- a/python/paddle/fluid/layer_helper.py +++ b/python/paddle/fluid/layer_helper.py @@ -50,7 +50,6 @@ class LayerHelper(object): def _np_to_variable(self, x): tensor = core.LoDTensor() - sys.stderr.write('%s %s\n' % (tensor, x)) tensor.set(x, core.CPUPlace()) return Variable( self.main_program.current_block(), @@ -67,12 +66,6 @@ class LayerHelper(object): else: raise ValueError("inputs wrong type %s\n" % x) - def to_variables(self, inputs): - if isinstance(inputs, list) or isinstance(inputs, tuple): - return [self._to_variable(x) for x in inputs] - else: - return [self._to_variable(inputs)] - def append_op(self, *args, **kwargs): return self.main_program.current_block().append_op(*args, **kwargs) -- GitLab