本文整理匯總了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)