from mxnet import nd
n_train, n_test, true_w, true_b = 100, 100, [1.2, -3.4, 5.6], 5
features = nd.random.normal(shape=(n_train + n_test, 1))
poly_features = nd.concat(features, nd.power(features, 2),
nd.power(features, 3))
labels = (true_w[0] * poly_features[:, 0] + true_w[1] * poly_features[:, 1] + true_w[2] * poly_features[:, 2] + true_b)
labels += nd.random.normal(scale=0.01, shape=labels.shape)
print(labels[:2])
Поскольку формы features
и poly_features
являются двумерными NDArray, я думаю, что вывод этого кода будет выглядеть так:
NDArray 2x1 @cpu(0)
,
но реальная форма вывода
NDArray 2 @cpu(0)
.
Почему вывод не является 2D NDArray?