T.shape is expecting a tensor, not a layer object.
On 2018-04-07 03:47 PM, Ashwini Rahangdale wrote:
for h in H_layers:
network = lasagne.layers.DenseLayer(network, h,
nonlinearity=leaky_rectify, W=lasagne.init.GlorotNormal())#network is
incoming network, h is num of units
network = lasagne.layers.DenseLayer(network, len(y_train),
nonlinearity=sigmoid, W=lasagne.init.GlorotNormal())
params_original = lasagne.layers.get_all_param_values(network)
params = lasagne.layers.get_all_params(network, trainable=True)
layers = lasagne.layers.get_all_layers(network)
get_params = lasagne.layers.get_all_param_values(network)
#define loss function
prediction = lasagne.layers.get_output(network)
dim = lasagne.layers.get_output_shape(network)
loss = lasagne.objectives.categorical_crossentropy(prediction,
target_var)
Hello,
In the above code, I want the predicted value at the output layer. Thus,
I am trying to get it using T.sahpe(network).eval and T.eval(prediction)
But using these command I am getting following errors and unable to
locate it. Please help to configure this error.
T.shape(network).eval()
Traceback (most recent call last):
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\type.py",
line 269, in dtype_specs
}[self.dtype]
KeyError: 'object'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\basic.py",
line 246, in constant
ttype = TensorType(dtype=x_.dtype, broadcastable=bcastable)
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\type.py",
line 51, in __init__
self.dtype_specs() # error checking is done there
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\type.py",
line 272, in dtype_specs
% (self.__class__.__name__, self.dtype))
TypeError: Unsupported dtype for TensorType: object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\basic.py",
line 194, in as_tensor_variable
return constant(x, name=name, ndim=ndim)
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\basic.py",
line 266, in constant
raise TypeError("Could not convert %s to TensorType" % x, type(x))
TypeError: ('Could not convert <lasagne.layers.dense.DenseLayer object
at 0x00000263DD6F7828> to TensorType', <class
'lasagne.layers.dense.DenseLayer'>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#37>", line 1, in <module>
T.shape(network).eval()
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\op.py",
line 615, in __call__
node = self.make_node(*inputs, **kwargs)
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\ops.py",
line 252, in make_node
x = theano.tensor.as_tensor_variable(x)
File
"C:\Users\Ashwini\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\tensor\basic.py",
line 200, in as_tensor_variable
raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
theano.tensor.var.AsTensorError: ('Cannot convert
<lasagne.layers.dense.DenseLayer object at 0x00000263DD6F7828> to
TensorType', <class 'lasagne.layers.dense.DenseLayer'>)
Please reply as soon as possibel.
--
---
You received this message because you are subscribed to the Google
Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to theano-users+unsubscr...@googlegroups.com
<mailto:theano-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
Pascal Lamblin
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.