matroid / dlwithtf

TensorFlow for Deep Learning Book
http://shop.oreilly.com/product/0636920065869.do
321 stars 160 forks source link

Type mismatch in ch4/fcnet_classification_tf.py #22

Open alex-mashin opened 3 years ago

alex-mashin commented 3 years ago
Traceback (most recent call last):
  File "fcnet_classification_tf.py", line 17, in <module>
    y_zeros = np.zeros((N/2,))
TypeError: 'float' object cannot be interpreted as an integer

and in other lines. To correct, sed -i 's|N/2|N//2|g' ch4/fcnet_classification_tf.py.

MadMMan commented 3 years ago

I have the same error, When I searched Google it says to use "//" instead of "/". Then it starts giving different errors. This time Google is saying versions mismatch. I am using TF Version: 2.1.0 which is compatible with (python Version: 3.7, scipy Version: 1.4.1).

mean=np.array((-1, -1)), cov=.1*np.eye(2), size=(N/2,)) File "mtrand.pyx", line 4079, in numpy.random.mtrand.RandomState.multivariate_normal File "mtrand.pyx", line 1390, in numpy.random.mtrand.RandomState.standard_normal File "_common.pyx", line 577, in numpy.random._common.cont TypeError: 'float' object cannot be interpreted as an integer