Вот весь код:
import numpy as np
i1 = np.array([[-1,0],
[-1,1],
[0,0],
[0,1],
[1,0],
[1,1]]);
out = [-1,1,0,1,1,1];
np.random.seed(1);
syn0 = 2*np.random.random((2,3)) - 1
syn1 = 2*np.random.random((3,1)) - 1
for iter in range(60000):
l0 = i1;
l1 = np.tanh(np.dot(l0,syn0));
l2 = np.tanh(np.dot(l1,syn1));
l2_error = out - l2;
if (iter % 10000) == 0:
print( "Error:" + str(np.mean(np.abs(l2_error))));
l2_delta = l2_error*np.tanh(l2);
l1_error = l2_delta.dot(syn1.T);
l1_delta = l1_error * np.tanh(l1);
syn1 += l1.T.dot(l2_delta);
syn0 += l0.T.dot(l1_delta);
print(l2);
В строке
l1_error = l2_delta.dot(syn1.T); выдаёт ошибку
ValueError: shapes (6,6) and (1,3) not aligned: 6 (dim 1) != 1 (dim 0)
Как это исправить?