Skip to content
Permalink
Browse files

Merge pull request #686 from microsoft/fix-load-weights

Fix load weights
  • Loading branch information...
rainLiuplus committed Jun 25, 2019
2 parents b272f5b + 5e547c2 commit 9a5d2cf00e383ca350c20cb7a5d90af9bf3d3ac2
@@ -54,9 +54,9 @@ def load_weights(weight_file):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict
@@ -654,4 +654,7 @@ def emit_Elu(self, IR_node):
self.add_body(1, "n.{:<15} = L.ELU(n.{}, in_place={}, ntop=1)".format(
IR_node.variable_name,
self.parent_variable_name(IR_node),
in_place))
in_place))

def emit_SpaceToDepth(self, IR_node):
self.add_body(1, "")
@@ -64,9 +64,9 @@ def load_weights(weight_file):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict
@@ -63,9 +63,9 @@ def header_code(self):
weights_dict = dict()
def load_weights_from_file(weight_file):
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict
@@ -231,9 +231,9 @@ def gen_weight_code(self, shape, phase):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
arg_params = dict()
aux_params = dict()
@@ -43,9 +43,9 @@ def load_weights(weight_file):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict
@@ -78,9 +78,9 @@ def load_weights(weight_file):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict
@@ -42,9 +42,9 @@ def load_weights(weight_file):
return
try:
weights_dict = np.load(weight_file).item()
weights_dict = np.load(weight_file, allow_pickle=True).item()
except:
weights_dict = np.load(weight_file, encoding='bytes').item()
weights_dict = np.load(weight_file, allow_pickle=True, encoding='bytes').item()
return weights_dict

0 comments on commit 9a5d2cf

Please sign in to comment.
You can’t perform that action at this time.