Thank you very much for your reply. This problem has been solved by https://github.com/fchollet/keras/pull/6483.
在 2017年5月3日星期三 UTC+8上午10:30:03,nouiz写道: > > I'm able to reproduce it with this line: > > THEANO_FLAGS=device=cuda,floatX=float32 python -c "import theano;import > numpy as np;s=theano.shared(np.asarray([[1.,2.],[1.,2.], [5,6]]));print > s.type; s.set_value(s.get_value(borrow=True, > return_internal_type=True)[::2], borrow=True); s.set_value([[0,0],[1,1]])" > > So even if I can't reproduce it with your code, I was able to work on it. > > I have a fix here: > > https://github.com/Theano/Theano/pull/5913 > > thanks for the report. > > Frédéric > > On Mon, May 1, 2017 at 8:57 AM Frédéric Bastien <[email protected] > <javascript:>> wrote: > >> I just tried and it worked. Can you update to Theano dev version and >> keras dev version? I used those version. >> >> On Mon, May 1, 2017 at 4:19 AM 111Moderato <[email protected] >> <javascript:>> wrote: >> >>> from keras.applications.vgg16 import VGG16 >>> >>> model=VGG16(include_top=False, weights='imagenet', input_tensor=None, >>> input_shape=None, pooling=None, classes=1000) >>> model.summary() >>> >>> I ran this code very successful on the CPU, but the error on the GPU as >>> follows: >>> >>> Using Theano backend. >>> Using cuDNN version 5105 on context None >>> Mapped name None to device cuda: GeForce GTX TITAN X (0000:02:00.0) >>> Traceback (most recent call last): >>> File "/home/xy/workspace/MyProject/1.py", line 12, in <module> >>> model=VGG16(include_top=False, weights='imagenet', input_tensor=None, >>> input_shape=None, pooling=None, classes=1000) >>> File >>> "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/applications/vgg16.py", >>> line 171, in VGG16 >>> layer_utils.convert_all_kernels_in_model(model) >>> File >>> "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/utils/layer_utils.py", >>> line 148, in convert_all_kernels_in_model >>> K.batch_set_value(to_assign) >>> File >>> "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/backend/theano_backend.py", >>> line 1126, in batch_set_value >>> x.set_value(np.asarray(value, dtype=x.dtype)) >>> File "/usr/local/lib/python2.7/dist-packages/theano/gpuarray/type.py", >>> line 637, in set_value >>> self.container.value = value >>> File "/usr/local/lib/python2.7/dist-packages/theano/gof/link.py", line >>> 477, in __set__ >>> **kwargs) >>> File "/usr/local/lib/python2.7/dist-packages/theano/gpuarray/type.py", >>> line 296, in filter_inplace >>> old_data.write(data) >>> File "pygpu/gpuarray.pyx", line 1655, in pygpu.gpuarray.GpuArray.write >>> (pygpu/gpuarray.c:20879) >>> ValueError: ('Destination GpuArray is not contiguous', 'Container name >>> "block1_conv1/kernel"') >>> >>> How can i solve it? >>> my configuration is : >>> >>> ubuntu 14.04 >>> python 2.7 >>> theano 0.9.0 >>> keras 2.0.3 >>> cudnn 5.1 >>> cuda 7.5 >>> >>> I tried to let VGG16's weights = None,also succeeded. So I guess the >>> data type of the weight is not compatible with the GPU. But I do not know >>> what to do with it. >>> >>> >>> I mentioned the problem in the keras page, get the following answer from >>> the Owner: >>> >>> The error occurs when we attempt to set the value of a Theano variable >>> using a Numpy array, at line >>> x.set_value(np.asarray(value, dtype=x.dtype)) >>> >>> This appears to be a Theano issue, so you should ask on the Theano >>> mailing list / repo. >>> >>> -- >>> >>> --- >>> 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] <javascript:>. >>> 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
