問題点
ゼロから始めるDeepLearning3章76pのコード実行をすると、
'sample_weight.pkl'が、ファイルそのものは存在するのに認識されない状態になっている
発生している問題・エラーメッセージ
FileNotFoundError: [Error2] No such file or directory: 'sample_weight_pkl'
該当のソースコード
def get_data(): (x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, flatten=True, one_hot_label=False) return x_test, t_test def init_network(): with open("sample_weight.pkl", 'rb') as f: network = pickle.load(f) return network def predict(network, x): W1, W2, W3 = network['W1'], network['W2'], network['W3'] b1, b2, b3 = network['b1'], network['b2'], network['b3'] a1 = np.dot(x, W1) + b1 z1 = sigmoid(a1) a2 = np.dot(z1, W2) + b2 z2 = sigmoid(a2) a3 = np.dot(z2, W3) + b3 y = softmax(a3) return y x, t = get_data() network = init_network()
試したこと
指定方法をデスクトップ上においてあるファイルを直接指定したがダメだった。
with open("'/Users/ユーザー名/Desktop/DeepLearning/ch03/sample_weight.pkl", 'rb')

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/29 14:49
2021/03/27 09:53