gen-quickstart
gen-quickstart copied to clipboard
Tutorial 3 "Tesorflow" is broken
I run the tutorial notebooks in a docker as proposed in the ReadMe. Everything works fine, except tutorial no 3.
when running Cell 4
# input images, shape (N, 784)
xs = tf.placeholder(tf.float64)
# weight matrix parameter for soft-max regression, shape (784, 10)
# initialize to a zeros matrix generated by Julia.
init_W = zeros(Float64, 784, 10)
W = tf.Variable(init_W)
# bias vector parameter for soft-max regression, shape (10,)
# initialize to a zeros vector generated by Julia.
init_b = zeros(Float64, 10)
b = tf.Variable(init_b)
# probabilities for each class, shape (N, 10)
probs = nn.softmax(tf.add(tf.matmul(xs, W), b), axis=1);
I get the following errormessage:
PyError ($(Expr(:escape, :(ccall(#= /root/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("unsupported operand type(s) for -: 'NoneType' and 'int'",)
File "/venv/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/venv/lib/python3.5/site-packages/tensorflow/python/ops/nn_ops.py", line 2903, in softmax
return _softmax(logits, gen_nn_ops.softmax, axis, name)
File "/venv/lib/python3.5/site-packages/tensorflow/python/ops/nn_ops.py", line 2833, in _softmax
is_last_dim = (dim == -1) or (dim == shape.ndims - 1)
Stacktrace:
[1] pyerr_check at /root/.julia/packages/PyCall/0jMpb/src/exception.jl:60 [inlined]
[2] pyerr_check at /root/.julia/packages/PyCall/0jMpb/src/exception.jl:64 [inlined]
[3] macro expansion at /root/.julia/packages/PyCall/0jMpb/src/exception.jl:84 [inlined]
[4] __pycall!(::PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyObject, ::PyObject) at /root/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44
[5] _pycall!(::PyObject, ::PyObject, ::Tuple{PyObject}, ::Int64, ::PyObject) at /root/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:29
[6] _pycall!(::PyObject, ::PyObject, ::Tuple{PyObject}, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:axis,),Tuple{Int64}}}) at /root/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:11
[7] #call#89 at /root/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:89 [inlined]
[8] (::getfield(PyCall, Symbol("#kw#PyObject")))(::NamedTuple{(:axis,),Tuple{Int64}}, ::PyObject, ::PyObject) at ./none:0
[9] top-level scope at In[4]:13
As all cells before this one work I guess the installation of tensorflow into the docker container was successful. Any Ideas?
It appears that tf2.0 is installed in the container. That api no longer uses placeholders. It would be nice to see this tutorial reworked with tf2.0