Discussion:
[theano-users] Replace a Shared Variable by a scalar
d***@gmail.com
2017-08-05 00:22:37 UTC
Permalink
Hello,

How can I replace a shared variable by a scalar in a graph? I am in
particular interested in replacing it by its current value. For instance,
say I have
z = T.scalar('z')
x = theano.shared(1.0, 'x')
y = z + x
I would like to evaluate x in the above graph, so as to end up with a
Tensor Variable y
y = z + 1.0
which does not depend anymore on any Shared Variable. How can I do this?

Thanks!

Daniel
--
---
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.
Frédéric Bastien
2017-08-09 18:35:58 UTC
Permalink
When you do y=... You don't replace y. Theano create a new node (a Python
object), and assign it to a Python variable y.

It is the same as if you named the second variable y2.

I don't understand what you want to do, so I can't be more precise.

Fred
Post by d***@gmail.com
Hello,
How can I replace a shared variable by a scalar in a graph? I am in
particular interested in replacing it by its current value. For instance,
say I have
z = T.scalar('z')
x = theano.shared(1.0, 'x')
y = z + x
I would like to evaluate x in the above graph, so as to end up with a
Tensor Variable y
y = z + 1.0
which does not depend anymore on any Shared Variable. How can I do this?
Thanks!
Daniel
--
---
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
For more options, visit https://groups.google.com/d/optout.
--
---
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...