<s> from __future__ import absolute_import , print_function , division <EOL> import numpy <EOL> import unittest <EOL> from nose . plugins . skip import SkipTest <EOL> import theano <EOL> mode_with_opt = theano . compile . mode . get_default_mode ( ) <EOL> mode_with_gpu = theano . compile . mode . get_default_mode ( ) . including ( '<STR_LIT>' ) <EOL> def test_viewop_gpu ( ) : <EOL> from theano . sandbox import cuda <EOL> if cuda . cuda_available == False : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> _x = theano . tensor . fvector ( '<STR_LIT:x>' ) <EOL> x = cuda . gpu_from_host ( _x ) <EOL> _out = theano . compile . ViewOp ( ) ( x ) <EOL> out = cuda . host_from_gpu ( _out ) <EOL> f = theano . function ( [ x ] , <EOL> out , <EOL> mode = mode_with_gpu ) <EOL> data = numpy . array ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , dtype = '<STR_LIT>' ) <EOL> assert numpy . allclose ( f ( data ) , data ) </s>
