Skip to content

Commit

Permalink
fix the outputs of net is x,x
Browse files Browse the repository at this point in the history
  • Loading branch information
2742195759 committed Jul 13, 2022
1 parent 2af286a commit 6fdfcf1
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -441,18 +441,26 @@ def _prepare(self, inputs):
continue
input_vars.append(var)

# mapping from name(string) -> VarBase
out_varbase_map = {}

def create_out(var_id):
var = self._outputs[var_id]
assert isinstance(var, framework.Variable)
var_desc = var.desc
varbase = None

if var_desc.name() in out_varbase_map:
return out_varbase_map[var_desc.name()]

if not framework._in_eager_mode_:
var_base = core.VarBase(var_desc.dtype(), var_desc.shape(),
var_desc.name(), var_desc.type(), False)
else:
var_base = core.eager.Tensor(var_desc.dtype(), var_desc.shape(),
var_desc.name(), var_desc.type(),
False)
out_varbase_map[var_desc.name()] = var_base
return var_base

# Create VarBase to receive output data.
Expand Down

0 comments on commit 6fdfcf1

Please sign in to comment.