Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block gradients in 03_energy.py #2

Open
mateuszmalinowski opened this issue Sep 28, 2014 · 0 comments
Open

Block gradients in 03_energy.py #2

mateuszmalinowski opened this issue Sep 28, 2014 · 0 comments

Comments

@mateuszmalinowski
Copy link

Not really an issue, but rather a question.

I don't see the difference between both cases in the 03_energy.py example:

  1. taking V and H as constants
  2. differentianting over them

If I comment out the _ElemwiseNoGradient class and use T.grad(energy(W,V,H).mean(),W) in grad_expected_energy I still get correct answer.

On the other hand I get an error if I switch mode to FAST_COMPILE (both cases).

Error:
MethodNotDefined: ('perform', <class 'theano.sandbox.rng_mrg.GPU_mrg_uniform'>, 'GPU_mrg_uniform')
Apply node that caused the error: GPU_mrg_uniform{CudaNdarrayType(float32, vector),no_inplace}(<CudaNdarrayType(float32, vector)>, TensorConstant{(1,) of 12})
Inputs types: [CudaNdarrayType(float32, vector), TensorType(int32, (True,))]
Inputs shapes: [(12,), (1,)]
Inputs strides: [(1,), (4,)]
Inputs scalar values: ['not scalar', array([12], dtype=int32)]

Backtrace when the node is created:
File "03_energy.py", line 55, in
W = rng_factory.normal(size=(nv, nh), dtype=v0.dtype)
File "/local/lib/python2.7/site-packages/theano/sandbox/rng_mrg.py", line 1328, in normal
nstreams=nstreams)
File "/local/lib/python2.7/site-packages/theano/sandbox/rng_mrg.py", line 1210, in uniform
ndim, dtype, size))
File "/local/lib/python2.7/site-packages/theano/sandbox/rng_mrg.py", line 545, in new
return op(rstate, cast(v_size, 'int32'))

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint of this apply node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant