<s> from __future__ import print_function <EOL> import numpy <EOL> from theano import Op , Apply , config <EOL> from six import StringIO <EOL> try : <EOL> import pygpu <EOL> from pygpu import gpuarray <EOL> except ImportError : <EOL> pass <EOL> from . basic_ops import ( as_gpuarray_variable , GpuKernelBase , Kernel , <EOL> infer_context_name ) <EOL> from . type import GpuArrayType <EOL> from . kernel_codegen import ( nvcc_kernel , <EOL> inline_softmax , <EOL> inline_softmax_fixed_shared ) <EOL> from . fp16_help import work_dtype , load_w , write_w <EOL> class GpuCrossentropySoftmaxArgmax1HotWithBias ( GpuKernelBase , Op ) : <EOL> """<STR_LIT>""" <EOL> nin = <NUM_LIT:3> <EOL> nout = <NUM_LIT:3> <EOL> __props__ = ( ) <EOL> _f16_ok = True <EOL> def make_node ( self , x , b , y_idx ) : <EOL> ctx_name = infer_context_name ( x , b , y_idx ) <EOL> x = as_gpuarray_variable ( x , ctx_name ) <EOL> b = as_gpuarray_variable ( b , ctx_name ) <EOL> y_idx = as_gpuarray_variable ( y_idx , ctx_name ) <EOL> nll = GpuArrayType ( x . type . dtype , <EOL> y_idx . type . broadcastable , <EOL> context_name = ctx_name ) ( ) <EOL> sm = x . type ( ) <EOL> am = y_idx . type ( ) <EOL> return Apply ( self , [ x , b , y_idx ] , [ nll , sm , am ] ) <EOL> def get_params ( self , node ) : <EOL> return node . inputs [ <NUM_LIT:0> ] . type . context <EOL> def c_headers ( self ) : <EOL> return [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def gpu_kernels ( self , node , nodename ) : <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_b = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_y_idx = node . inputs [ <NUM_LIT:2> ] . dtype <EOL> work_x = work_dtype ( dtype_x ) <EOL> work_b = work_dtype ( dtype_b ) <EOL> load_x = load_w ( dtype_x ) <EOL> load_b = load_w ( dtype_b ) <EOL> write_x = write_w ( dtype_x ) <EOL> write_b = write_w ( dtype_b ) <EOL> flags = Kernel . get_flags ( dtype_x , dtype_b , dtype_y_idx ) <EOL> type_x = gpuarray . dtype_to_ctype ( dtype_x ) <EOL> type_b = gpuarray . dtype_to_ctype ( dtype_b ) <EOL> work_x = gpuarray . dtype_to_ctype ( work_x ) <EOL> type_y_idx = gpuarray . dtype_to_ctype ( dtype_y_idx ) <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> f = '<STR_LIT>' if dtype_x == '<STR_LIT>' else '<STR_LIT:f>' <EOL> sio = StringIO ( ) <EOL> print ( """<STR_LIT>""" % locals ( ) , file = sio ) <EOL> params = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> return [ Kernel ( code = sio . getvalue ( ) , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ] <EOL> def c_code ( self , node , nodename , inp , out , sub ) : <EOL> if node . inputs [ <NUM_LIT:0> ] . type . context . kind != '<STR_LIT>' : <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> typecode_x = pygpu . gpuarray . dtype_to_typecode ( node . inputs [ <NUM_LIT:0> ] . dtype ) <EOL> typecode_b = pygpu . gpuarray . dtype_to_typecode ( node . inputs [ <NUM_LIT:1> ] . dtype ) <EOL> typecode_y_idx = pygpu . gpuarray . dtype_to_typecode ( node . inputs [ <NUM_LIT:2> ] . dtype ) <EOL> itemsize_x = numpy . dtype ( node . inputs [ <NUM_LIT:0> ] . dtype ) . itemsize <EOL> worksize_x = numpy . dtype ( work_dtype ( node . inputs [ <NUM_LIT:0> ] . dtype ) ) . itemsize <EOL> itemsize_b = numpy . dtype ( node . inputs [ <NUM_LIT:1> ] . dtype ) . itemsize <EOL> itemsize_y_idx = numpy . dtype ( node . inputs [ <NUM_LIT:2> ] . dtype ) . itemsize <EOL> itemsize_nll = numpy . dtype ( node . outputs [ <NUM_LIT:0> ] . dtype ) . itemsize <EOL> itemsize_sm = numpy . dtype ( node . outputs [ <NUM_LIT:1> ] . dtype ) . itemsize <EOL> itemsize_am = numpy . dtype ( node . outputs [ <NUM_LIT:2> ] . dtype ) . itemsize <EOL> x , b , y_idx = inp <EOL> nll , sm , am = out <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_b = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_y_idx = node . inputs [ <NUM_LIT:2> ] . dtype <EOL> dtype_nll = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_sm = node . outputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_am = node . outputs [ <NUM_LIT:2> ] . dtype <EOL> classname = self . __class__ . __name__ <EOL> fail = sub [ '<STR_LIT>' ] <EOL> ctx = sub [ '<STR_LIT>' ] <EOL> k_var = "<STR_LIT>" % locals ( ) <EOL> err_check = """<STR_LIT>""" % locals ( ) <EOL> sync = "<STR_LIT>" <EOL> if config . gpuarray . sync : <EOL> sync = """<STR_LIT>""" % locals ( ) <EOL> sio = StringIO ( ) <EOL> print ( """<STR_LIT>""" % locals ( ) , file = sio ) <EOL> return sio . getvalue ( ) <EOL> def c_code_cache_version ( self ) : <EOL> return ( <NUM_LIT:10> , ) <EOL> gpu_crossentropy_softmax_argmax_1hot_with_bias = GpuCrossentropySoftmaxArgmax1HotWithBias ( ) <EOL> class GpuCrossentropySoftmax1HotWithBiasDx ( GpuKernelBase , Op ) : <EOL> """<STR_LIT>""" <EOL> nin = <NUM_LIT:3> <EOL> nout = <NUM_LIT:1> <EOL> __props__ = ( ) <EOL> _f16_ok = True <EOL> def make_node ( self , dnll , sm , y_idx ) : <EOL> ctx_name = infer_context_name ( dnll , sm , y_idx ) <EOL> dnll = as_gpuarray_variable ( dnll , ctx_name ) <EOL> sm = as_gpuarray_variable ( sm , ctx_name ) <EOL> y_idx = as_gpuarray_variable ( y_idx , ctx_name ) <EOL> return Apply ( self , [ dnll , sm , y_idx ] , [ sm . type ( ) ] ) <EOL> def get_params ( self , node ) : <EOL> return node . inputs [ <NUM_LIT:0> ] . type . context <EOL> def c_code_cache_version ( self ) : <EOL> return ( <NUM_LIT:11> , ) <EOL> def c_headers ( self ) : <EOL> return [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def c_code ( self , node , nodename , inp , out , sub ) : <EOL> if node . inputs [ <NUM_LIT:0> ] . type . context . kind != '<STR_LIT>' : <EOL> raise NotImplementedError ( "<STR_LIT>" ) <EOL> typecode_dx = pygpu . gpuarray . dtype_to_typecode ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> itemsize_dnll = numpy . dtype ( node . inputs [ <NUM_LIT:0> ] . dtype ) . itemsize <EOL> itemsize_sm = numpy . dtype ( node . inputs [ <NUM_LIT:1> ] . dtype ) . itemsize <EOL> itemsize_y_idx = numpy . dtype ( node . inputs [ <NUM_LIT:2> ] . dtype ) . itemsize <EOL> itemsize_dx = numpy . dtype ( node . outputs [ <NUM_LIT:0> ] . dtype ) . itemsize <EOL> dtype_dnll = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_sm = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_y_idx = node . inputs [ <NUM_LIT:2> ] . dtype <EOL> dtype_dx = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> type_intp = gpuarray . dtype_to_ctype ( numpy . intp ) <EOL> dnll , sm , y_idx = inp <EOL> dx , = out <EOL> fail = sub [ '<STR_LIT>' ] <EOL> ctx = sub [ '<STR_LIT>' ] <EOL> k_var = "<STR_LIT>" + nodename <EOL> err_check = """<STR_LIT>""" % locals ( ) <EOL> sync = "<STR_LIT>" <EOL> if config . gpuarray . sync : <EOL> sync = """<STR_LIT>""" % locals ( ) <EOL> return """<STR_LIT>""" % locals ( ) <EOL> def gpu_kernels ( self , node , nodename ) : <EOL> dtype_dnll = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_sm = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_y_idx = node . inputs [ <NUM_LIT:2> ] . dtype <EOL> dtype_dx = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> work_dnll = work_dtype ( dtype_dnll ) <EOL> load_dnll = load_w ( dtype_dnll ) <EOL> load_sm = load_w ( dtype_sm ) <EOL> write_dx = write_w ( dtype_dx ) <EOL> flags = Kernel . get_flags ( dtype_dnll , dtype_sm , dtype_y_idx , dtype_dx ) <EOL> type_dnll = gpuarray . dtype_to_ctype ( work_dnll ) <EOL> type_sm = gpuarray . dtype_to_ctype ( dtype_sm ) <EOL> type_y_idx = gpuarray . dtype_to_ctype ( dtype_y_idx ) <EOL> type_dx = gpuarray . dtype_to_ctype ( dtype_dx ) <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> sio = StringIO ( ) <EOL> print ( """<STR_LIT>""" % locals ( ) , file = sio ) <EOL> params = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> return [ Kernel ( code = sio . getvalue ( ) , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ] <EOL> gpu_crossentropy_softmax_1hot_with_bias_dx = GpuCrossentropySoftmax1HotWithBiasDx ( ) <EOL> class GpuSoftmax ( GpuKernelBase , Op ) : <EOL> """<STR_LIT>""" <EOL> __props__ = ( ) <EOL> _f16_ok = True <EOL> def make_node ( self , x ) : <EOL> x = as_gpuarray_variable ( x , infer_context_name ( x ) ) <EOL> return Apply ( self , [ x ] , [ x . type ( ) ] ) <EOL> def get_params ( self , node ) : <EOL> return node . inputs [ <NUM_LIT:0> ] . type . context <EOL> def infer_shape ( self , node , shape ) : <EOL> return shape <EOL> def c_code_cache_version ( self ) : <EOL> return ( <NUM_LIT:15> , ) + inline_softmax . code_version <EOL> def c_headers ( self ) : <EOL> return [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def c_code ( self , node , nodename , inp , out , sub ) : <EOL> if node . inputs [ <NUM_LIT:0> ] . type . context . kind != '<STR_LIT>' : <EOL> raise NotImplementedError ( "<STR_LIT>" ) <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> work_x = work_dtype ( dtype_x ) <EOL> dtype_z = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> itemsize_x = numpy . dtype ( dtype_x ) . itemsize <EOL> itemsize_z = numpy . dtype ( dtype_z ) . itemsize <EOL> typecode = pygpu . gpuarray . dtype_to_typecode ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> x , = inp <EOL> z , = out <EOL> fail = sub [ '<STR_LIT>' ] <EOL> ctx = sub [ '<STR_LIT>' ] <EOL> err_check = """<STR_LIT>""" % locals ( ) <EOL> sync = "<STR_LIT>" <EOL> if config . gpuarray . sync : <EOL> sync = """<STR_LIT>""" % locals ( ) <EOL> else : <EOL> sync = "<STR_LIT>" <EOL> return """<STR_LIT>""" % locals ( ) <EOL> def gpu_kernels ( self , node , nodename ) : <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_sm = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> load_x = load_w ( dtype_x ) <EOL> write_sm = write_w ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> work_sm = work_dtype ( dtype_sm ) <EOL> flags = Kernel . get_flags ( dtype_x , dtype_sm ) <EOL> type_x = gpuarray . dtype_to_ctype ( dtype_x ) <EOL> type_sm = gpuarray . dtype_to_ctype ( dtype_sm ) <EOL> type_acc = gpuarray . dtype_to_ctype ( work_sm ) <EOL> params = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> kernels = [ ] <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> code = nvcc_kernel ( <EOL> kname , <EOL> params = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_x , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_sm , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] , <EOL> body = [ "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_sm , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % load_x , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> "<STR_LIT>" , <EOL> inline_softmax ( '<STR_LIT:N>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , dtype = work_sm ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % write_sm , <EOL> "<STR_LIT:}>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> ] ) <EOL> kernels . append ( Kernel ( code = code , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ) <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> code = nvcc_kernel ( <EOL> kname , <EOL> params = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_x , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_sm , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] , <EOL> body = [ "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_sm , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_sm , <EOL> inline_softmax_fixed_shared ( '<STR_LIT:N>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> load_x , <EOL> '<STR_LIT>' , '<STR_LIT>' , write_sm , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> dtype = work_sm ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> ] ) <EOL> kernels . append ( Kernel ( code = code , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ) <EOL> return kernels <EOL> gpu_softmax = GpuSoftmax ( ) <EOL> class GpuSoftmaxWithBias ( GpuKernelBase , Op ) : <EOL> """<STR_LIT>""" <EOL> nin = <NUM_LIT:2> <EOL> nout = <NUM_LIT:1> <EOL> __props__ = ( ) <EOL> _f16_ok = True <EOL> def make_node ( self , x , b ) : <EOL> ctx_name = infer_context_name ( x , b ) <EOL> x = as_gpuarray_variable ( x , ctx_name ) <EOL> b = as_gpuarray_variable ( b , ctx_name ) <EOL> return Apply ( self , [ x , b ] , [ x . type ( ) ] ) <EOL> def get_params ( self , node ) : <EOL> return node . inputs [ <NUM_LIT:0> ] . type . context <EOL> def infer_shape ( self , node , shape ) : <EOL> return [ shape [ <NUM_LIT:0> ] ] <EOL> def c_code_cache_version ( self ) : <EOL> return ( <NUM_LIT> , ) + inline_softmax . code_version <EOL> def c_headers ( self ) : <EOL> return [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def c_code ( self , node , nodename , inp , out , sub ) : <EOL> if node . inputs [ <NUM_LIT:0> ] . type . context . kind != '<STR_LIT>' : <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_b = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_z = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> work_x = work_dtype ( dtype_x ) <EOL> itemsize_x = numpy . dtype ( dtype_x ) . itemsize <EOL> itemsize_b = numpy . dtype ( dtype_b ) . itemsize <EOL> itemsize_z = numpy . dtype ( dtype_z ) . itemsize <EOL> typecode = pygpu . gpuarray . dtype_to_typecode ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> x , b = inp <EOL> z , = out <EOL> fail = sub [ '<STR_LIT>' ] <EOL> ctx = sub [ '<STR_LIT>' ] <EOL> err_check = """<STR_LIT>""" % locals ( ) <EOL> sync = "<STR_LIT>" <EOL> if config . gpuarray . sync : <EOL> sync = """<STR_LIT>""" % locals ( ) <EOL> return """<STR_LIT>""" % locals ( ) <EOL> def gpu_kernels ( self , node , nodename ) : <EOL> dtype_x = node . inputs [ <NUM_LIT:0> ] . dtype <EOL> dtype_b = node . inputs [ <NUM_LIT:1> ] . dtype <EOL> dtype_sm = node . outputs [ <NUM_LIT:0> ] . dtype <EOL> load_x = load_w ( node . inputs [ <NUM_LIT:0> ] . dtype ) <EOL> load_b = load_w ( node . inputs [ <NUM_LIT:1> ] . dtype ) <EOL> write_sm = write_w ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> work_sm = work_dtype ( node . outputs [ <NUM_LIT:0> ] . dtype ) <EOL> flags = Kernel . get_flags ( dtype_x , dtype_b , dtype_sm ) <EOL> type_x = gpuarray . dtype_to_ctype ( dtype_x ) <EOL> type_b = gpuarray . dtype_to_ctype ( dtype_b ) <EOL> type_sm = gpuarray . dtype_to_ctype ( dtype_sm ) <EOL> type_acc = gpuarray . dtype_to_ctype ( work_sm ) <EOL> params = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , <EOL> gpuarray . GpuArray , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> kernels = [ ] <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> code = nvcc_kernel ( <EOL> kname , <EOL> params = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_x , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_b , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % type_sm , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] , <EOL> body = [ "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_b , <EOL> "<STR_LIT>" % type_sm , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % load_x , <EOL> "<STR_LIT>" % load_b , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> "<STR_LIT>" , <EOL> inline_softmax ( '<STR_LIT:N>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , work_sm ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % write_sm , <EOL> "<STR_LIT:}>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> ] ) <EOL> kernels . append ( Kernel ( code = code , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ) <EOL> kname = "<STR_LIT>" <EOL> k_var = "<STR_LIT>" + nodename <EOL> code = nvcc_kernel ( <EOL> kname , <EOL> params = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_x , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % type_b , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % type_sm , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] , <EOL> body = [ "<STR_LIT>" % type_acc , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_b , <EOL> "<STR_LIT>" % type_sm , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" % type_x , <EOL> "<STR_LIT>" % type_sm , <EOL> inline_softmax_fixed_shared ( '<STR_LIT:N>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> load_x , <EOL> '<STR_LIT>' , '<STR_LIT>' , write_sm , <EOL> '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT:b>' , '<STR_LIT>' , load_b , work_sm ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:}>" , <EOL> ] ) <EOL> kernels . append ( Kernel ( code = code , name = kname , params = params , <EOL> flags = flags , objvar = k_var ) ) <EOL> return kernels <EOL> gpu_softmax_with_bias = GpuSoftmaxWithBias ( ) </s>
