我在 Windows 10 上使用 Tensorflow 1.4.0 和 Python 3.6。我查看了其他关于值排序的帖子,但到目前为止没有发现任何有用的东西。
谢谢。
import tensorflow as tf
import numpy as np
from sklearn.datasets import fetch_california_housing
housing = fetch_california_housing()
m, n = housing.data.shape
housing_data_plus_bias = np.c_[np.ones((m, 1)), housing.data]
#normalization
scaled_housing_data_plus_bias = tf.nn.l2_normalize(housing_data_plus_bias, 1, epsilon=1e-12,name="Normalized")
n_epochs = 1000
learning_rate = 0.01
#error occurs here
X = tf.constant(scaled_housing_data_plus_bias, dtype=tf.float32, name="X")
Traceback (most recent call last):
File "C:/Users/tony/PycharmProjects/NNCourse/Hands-On_Book_5.py", line 14, in <module>
X = tf.constant(scaled_housing_data_plus_bias, dtype=tf.float32, name="X")
File "C:\Users\tony\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\constant_op.py", line 208, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape)) …Run Code Online (Sandbox Code Playgroud)