本文整理汇总了Python中dill.load_session方法的典型用法代码示例。如果您正苦于以下问题:Python dill.load_session方法的具体用法?Python dill.load_session怎么用?Python dill.load_session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dill
的用法示例。
在下文中一共展示了dill.load_session方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: session_load
# 需要导入模块: import dill [as 别名]
# 或者: from dill import load_session [as 别名]
def session_load(self, hash, fname_session):
"""
Load ipython session from file
:param hash: cell hash
:param fname_session: pathname to dumped session
:return:
"""
logging.debug('Cell {}: loading session from {}'.format(hash, fname_session))
# 'dill.settings["recurse"] = True',
# 'dill.settings["byref"] = True',
inject_code = ['import dill',
'dill.load_session(filename="{}")'.format(fname_session),
]
inject_cell = nbf.v4.new_code_cell('\n'.join(inject_code))
super().run_cell(inject_cell)
示例2: load_env
# 需要导入模块: import dill [as 别名]
# 或者: from dill import load_session [as 别名]
def load_env(file):
dill.load_session(file)
示例3: predict
# 需要导入模块: import dill [as 别名]
# 或者: from dill import load_session [as 别名]
def predict(self, filename, input):
dill.load_session(filename)
self.batch_size = 1
self.forward_pass(input)
a = self.layers[self.num_layers-1].activations
a[np.where(a==np.max(a))] = 1
a[np.where(a!=np.max(a))] = 0
return a
示例4: check_accuracy
# 需要导入模块: import dill [as 别名]
# 或者: from dill import load_session [as 别名]
def check_accuracy(self, filename, inputs, labels):
dill.load_session(filename)
self.batch_size = len(inputs)
self.forward_pass(inputs)
a = self.layers[self.num_layers-1].activations
a[np.where(a==np.max(a))] = 1
a[np.where(a!=np.max(a))] = 0
total=0
correct=0
for i in range(len(a)):
total += 1
if np.equal(a[i], labels[i]).all():
correct += 1
print("Accuracy: ", correct*100/total)
示例5: load_model
# 需要导入模块: import dill [as 别名]
# 或者: from dill import load_session [as 别名]
def load_model(self, filename):
dill.load_session(filename)