提交 f6f06924 编写于 作者: X Xin Pan

clean up

test=develop
上级 0318c951
......@@ -159,7 +159,6 @@ PYBIND11_MODULE(core, m) {
self.mutable_data<float>(place);
})
.def("set", PyCPUTensorSetFromArray<float>)
.def("set_float", PyCPUTensorSetFromArray<float>)
.def("set", PyCPUTensorSetFromArray<int>)
.def("set", PyCPUTensorSetFromArray<double>)
.def("set", PyCPUTensorSetFromArray<int64_t>)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册