x0_train = np.ones((len(X_train), 1)) # 构造X长度的全1数组配合对偏置的点积 X_train = np.append(x0_train, X_train, axis=1) #把X增加一系列的1 print ("张量X的形状:", X_train.shape) print (X_train)