Lasagne / Lasagne

Lightweight library to build and train neural networks in Theano

Home Page:http://lasagne.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to get the exact value of the tensor variable and its type.

rahashwini opened this issue · comments

Before submitting your issue, please check these hints!

  • If you have a usage question, please please post on our mailing list instead of creating an issue.
    Make sure to check the Lasagne documentation and the Theano documentation first!
    You can search the mailing list as well to see if your question has come up before.

  • If you suspect you have found a bug, please first try updating to the bleeding-edge versions of Theano and Lasagne. It may have been fixed already.
    If you are not sure whether the problem lies within your code, Theano, or Lasagne, first post on our mailing list.
    In any case, try to provide a minimal code example that reproduces the bug, this will greatly speed up the process of tracking down the problem.

  • If you have a feature request or idea, please include a clear description of the use case(s) it would enable, referencing research papers if applicable, and indicate whether you would be willing to implement the feature yourself.
    We are happy to discuss your suggestion, help refining it, and decide upfront whether it would fit the main library or our Lasagne/Recipes.

Traceback (most recent call last):
File "<pyshell#33>", line 1, in
T.shape(prediction).eval()
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\graph.py", line 522, in eval
self._fn_cache[inputs] = theano.function(inputs, self)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\function.py", line 317, in function
output_keys=output_keys)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\pfunc.py", line 486, in pfunc
output_keys=output_keys)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\function_module.py", line 1839, in orig_function
name=name)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\function_module.py", line 1487, in init
accept_inplace)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\function_module.py", line 181, in std_fgraph
update_mapping=update_mapping)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\fg.py", line 175, in init
self.import_r(output, reason="init")
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\fg.py", line 346, in import_r
self.import(variable.owner, reason=reason)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\fg.py", line 391, in import
raise MissingInputError(error_msg, variable=r)
theano.gof.fg.MissingInputError: Input 0 of the graph (indices start from 0), used to compute dot(X_train, W), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.

Backtrace when that variable is created:

File "", line 1, in
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\idlelib\run.py", line 144, in main
ret = method(*args, **kwargs)
File "C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\idlelib\run.py", line 474, in runcode
exec(code, self.locals)
File "G:\Implementation of the Project\Deep Neural Network for Learning to Rank\ispamm-group-lasso-deep-networks-179b38d3edb5\ispamm-group-lasso-deep-networks-179b38d3edb5\test7_list.py", line 130, in
input_var = T.matrix(name='X_train')

T.shape(prediction).eval()

eval() won't work unless you also give it some concrete input, such as T.shape(prediction).eval({input_var: your_input_data_as_a_numpy_array}).

If you're just interested in the shape of the prediction, however, you'll probably want to query the output layer of your network: output_layer.output_shape or network.output_shape, however it's called in your code. This will provide the shape tracked by Lasagne while creating the network, as far as it can be inferred from the shape given to the InputLayer. If the InputLayer shape is incomplete, you can use lasagne.layers.get_output_shape(network, (1, 2, 3, 4)) to compute the output shape for an input of shape (1, 2, 3, 4).