<s> from __future__ import absolute_import , print_function , division <EOL> from nose . plugins . skip import SkipTest <EOL> import numpy <EOL> from theano import function <EOL> from theano . tests import unittest_tools as utt <EOL> from theano . tensor import vector , matrix , dot <EOL> from . config import mode_with_gpu <EOL> from . . nerv import Gemm16 , nerv <EOL> def test_gemm16_swap ( ) : <EOL> if nerv is None : <EOL> raise SkipTest ( "<STR_LIT>" ) <EOL> v = vector ( dtype = '<STR_LIT>' ) <EOL> m = matrix ( dtype = '<STR_LIT>' ) <EOL> m2 = matrix ( dtype = '<STR_LIT>' ) <EOL> m32 = matrix ( dtype = '<STR_LIT>' ) <EOL> f = function ( [ v , m ] , dot ( v , m ) , mode = mode_with_gpu ) <EOL> assert len ( [ node for node in f . maker . fgraph . apply_nodes <EOL> if isinstance ( node . op , Gemm16 ) ] ) == <NUM_LIT:0> <EOL> f = function ( [ m32 , m ] , dot ( m32 , m ) , mode = mode_with_gpu ) <EOL> assert len ( [ node for node in f . maker . fgraph . apply_nodes <EOL> if isinstance ( node . op , Gemm16 ) ] ) == <NUM_LIT:0> <EOL> f = function ( [ m , m2 ] , dot ( m , m2 ) , mode = mode_with_gpu ) <EOL> assert len ( [ node for node in f . maker . fgraph . apply_nodes <EOL> if isinstance ( node . op , Gemm16 ) ] ) == <NUM_LIT:1> <EOL> def test_gemm16_value ( ) : <EOL> if nerv is None : <EOL> raise SkipTest ( "<STR_LIT>" ) <EOL> m = matrix ( dtype = '<STR_LIT>' ) <EOL> m2 = matrix ( dtype = '<STR_LIT>' ) <EOL> f = function ( [ m , m2 ] , dot ( m , m2 ) , mode = mode_with_gpu ) <EOL> v1 = numpy . random . random ( ( <NUM_LIT:3> , <NUM_LIT:4> ) ) . astype ( '<STR_LIT>' ) <EOL> v2 = numpy . random . random ( ( <NUM_LIT:4> , <NUM_LIT:2> ) ) . astype ( '<STR_LIT>' ) <EOL> of = f ( v1 , v2 ) <EOL> on = numpy . dot ( v1 , v2 ) <EOL> utt . assert_allclose ( of , on ) </s>
