diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 03fe1402c3b3b38264189d44737d6b0f1852f6a2..3cf1ec34a7a7642cd34bdc1f312ac1ffadaa3e5d 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 235d692afe84e813a57c27a3cc13eb286b1f5fc0..3d3263e7cda033f1df3492105736ae2c0d1f6d9d 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 32928347af8e805153c552dbbfe16d073f9c8bbe..15f69398464939d5889cb97a6ae802eab382cdac 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 ceabb52215ee5bc8487b90f23a12d47e6838a198..ca531f3be929e18895336f32e1e9d7ab108699b1 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)