Ich fange gerade an, cntk zu lernen. Ich habe jedoch eine grundlegende Frage, die mich davon abhält, Fortschritte zu machen. Ich habe folgenden Test, der übergibt:Warum inkonsistente Formen numpy vs cntk?
import numpy as np
from cntk import input_variable, plus
def test_simple(self):
x_input = np.asarray([[1, 2, 2]], dtype=np.int64)
assert (1, 3) == x_input.shape
y_input = np.asarray([[5, 3, 3]], dtype=np.int64)
assert (1, 3) == y_input.shape
x = input_variable(x_input.shape[1])
assert (3,) == x.shape
y = input_variable(y_input.shape[1])
assert (3,) == y.shape
x_plus_y = plus(x, y)
assert (3,) == x_plus_y.shape
res = x_plus_y.eval({x: x_input, y: y_input})
assert 6 == res[0, 0, 0]
assert 5 == res[0, 0, 1]
assert 5 == res[0, 0, 2]
Ich verstehe, dass die Form der Ausgabe ist (1, 1, 3) als die erste und die zweite Achse der Ansatz ist und jeweils dynamische Achse Standard.
Warum muss ich jedoch die Form der Eingabevariablen als (3,) statt (1, 3) festlegen. Die Verwendung von (1, 3) schlägt fehl.
Warum besteht eine Inkonsistenz zwischen der Form des Eingabeknotens im Diagramm und den als Eingabe für diesen Knoten verwendeten numpigen Daten?
Danke, Paddy