Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix graph dict bug #77

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions oneflow_onnx/onnx_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import collections
import copy
import logging
from typing import OrderedDict
import six
import numpy as np
import oneflow
Expand Down Expand Up @@ -861,10 +862,13 @@ def get_saved_tensor(self, node):
# TODO(daquexian): node.output_tensor_names[0] is "node_name/output_name", so this pathjoin doesn't work
# on windows (where path separator is "\")
key = ".".join(node.output_tensor_names[0].split(".")[1:])
try:
tensor_value = self._param_dict["m"][key[:key.rfind("out")-1]].numpy().reshape(self.get_shape(tensor_name)).astype(dtype=util.Onnx2NumpyDtype(self.get_dtype(tensor_name)))
except:
tensor_value = self._param_dict[key[:key.rfind("out")-1]].numpy().reshape(self.get_shape(tensor_name)).astype(dtype=util.Onnx2NumpyDtype(self.get_dtype(tensor_name)))
if len(list(self._param_dict.keys())) > 1:
tensor_value = self._param_dict[key[:key.rfind("out")-1]].numpy().reshape(self.get_shape(tensor_name)).astype(dtype=util.Onnx2NumpyDtype(self.get_dtype(tensor_name)))
else:
try:
tensor_value = self._param_dict[list(self._param_dict.keys())[0]][key[:key.rfind("out")-1]].numpy().reshape(self.get_shape(tensor_name)).astype(dtype=util.Onnx2NumpyDtype(self.get_dtype(tensor_name)))
except:
tensor_value = self._param_dict[key[:key.rfind("out")-1]].numpy().reshape(self.get_shape(tensor_name)).astype(dtype=util.Onnx2NumpyDtype(self.get_dtype(tensor_name)))
return tensor_value

def get_shape(self, name):
Expand Down