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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to