If you are calling dnn_conv directly, at least one of the inputs (say,
either X or w1) should already be on a GPU, so cuDNN knows which GPU to
use for the computation.
What is the type of w1, w2, etc.?
Are you running with device=cuda?
On Thu, Oct 20, 2016, Xi wrote:
> I am writing following code:
>
> ######################################################
>
> from theano.gpuarray.dnn import dnn_conv
>
>
> lX = T.tensor4()
>
>
> def convLayer(X, w1, w2, w3, w4):
> h1 = dnn_conv(img=X, kerns=w1, subsample=(2, 2), border_mode=(1, 1))
> h2 = dnn_conv(img=h1, kerns=w2, subsample=(2, 2), border_mode=(1, 1))
> h3 = dnn_conv(img=h2, kerns=w3, subsample=(2, 2), border_mode=(1, 1))
> h4 = dnn_conv(img=h3, kerns=w4, subsample=(2, 2), border_mode=(1, 1))
> h4 = T.flatten(h4, 2)
> return h4
>
>
> lX_conv = convLayer(lX, w1, w2, w3, w4)
>
>
> ######################################################
>
> I get an error like:
>
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "<input>", line 2, in convLayer
> File
> "/home/xi/Projects/Python/env/local/lib/python2.7/site-packages/theano/gpuarray/dnn.py",
> line 970, in dnn_conv
> ctx_name = infer_context_name(img, kerns)
> File
> "/home/xi/Projects/Python/env/local/lib/python2.7/site-packages/theano/gpuarray/basic_ops.py",
> line 122, in infer_context_name
> raise ValueError("Could not infer context from inputs")
> ValueError: Could not infer context from inputs
>
>
> I have tested this code on two configuration:
> 1. theano 0.9.dev3 + cuda 8 + cudnn 5.1
> 2. theano.9.0.dev1 + cuda 7.5 + cudnn 5.0
>
>
> In the past I am import cudnn from *theano.sandbox**.cuda.dnn*, everything
> runs good, however, not sure what wrong is when I try to import cudnn from
> *theano.gpuarray.dnn*
>
> Can anyone helps or give some suggestion?
>
>
>
> --
>
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
Pascal
--
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.