Discussion:
[theano-users] Theano + Lasagne: Creating a custom layer.
Luan Goncalves
2018-11-09 20:01:13 UTC
Permalink
Hi all,

I'm new to Theano and i need to create a custom layer (with Lasagne) to do
the following:

1) Takes the outputs of the previous layers (vectors with 5 points) as
input.

2) For each input vector i need to select the 20 most similar vectors (with
68 points) among the training set and compute the mean vector.

Obs.: It's important to note that the input vectors are composed by 5
points while the vector of the training set has 68 points (x,y). I want to
extract 5 points from the 68 points of each vector to compute the cosine
distance between the input and the vectors of the training set. Finally, my
output will be vectors with 68 points.

I made the attached code but i'm having the following error.

Could you help me please?

Thanks.

Using cuDNN version 7104 on context None
Mapped name None to device cuda: GeForce 940MX (0000:01:00.0)
Input shape: (None, 1, 112, 112)
Traceback (most recent call last):
File "DANtraining.py", line 16, in <module>
training.initializeNetwork() File
"/mnt/STORAGE/workspace/Python_tests/Mestrado/DeepAlignmentNetwork/FaceAlignmentTraining.py",
line 40, in initializeNetwork
self.prediction = lasagne.layers.get_output(self.network,
deterministic=False)
File
"/home/luan/.virtualenvs/theano/local/lib/python2.7/site-packages/lasagne/layers/helper.py",
line 197, in get_output
all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs)
File
"/mnt/STORAGE/workspace/Python_tests/Mestrado/DeepAlignmentNetwork/PriorShapeLayer.py",
line 53, in get_output_for
return theano.scan(self.cos_sim, input)
File
"/home/luan/.virtualenvs/theano/local/lib/python2.7/site-packages/theano/scan_module/scan.py",
line 774, in scan
condition, outputs, updates =
scan_utils.get_updates_and_outputs(fn(*args))
File
"/home/luan/.virtualenvs/theano/local/lib/python2.7/site-packages/theano/scan_module/scan_utils.py",
line 526, in get_updates_and_outputs
'The return value of your scan lambda expression may only be '
ValueError: The return value of your scan lambda expression may only be
made of lists, tuples, or dictionaries containing Theano variables (or
`theano.scan_module.until` objects f
or conditions). In particular if you need to use constant values, you can
use `tensor.constant` to turn them into Theano variables.
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...