def dtype_in_elemwise_supported(op):
 def get_all_basic_scalar(composite_op):
  l = []
  for i in composite_op.fgraph.toposort():
   if isinstance(i, theano.scalar.Composite):
    l += get_all_basic_scalar(i)
   else:
    l.append(i)
  return l
 if (isinstance(op, GpuElemwise) or isinstance(op, tensor.Elemwise)):
  if isinstance(op.scalar_op, theano.scalar.Composite):
   scals = get_all_basic_scalar(op.scalar_op)
   for s in scals:
    if any([(i.type.dtype not in elemwise_cuda_dtype_supported) for i in (s.inputs + s.outputs)]):
     return False
 return True

def dtype_in_elemwise_supported ( op ) : def get_all_basic_scalar ( composite_op ) : l = [ ] for i in composite_op . fgraph . toposort ( ) : if isinstance ( i , theano . scalar . Composite ) : l += get_all_basic_scalar ( i ) else : l . append ( i ) return l if ( isinstance ( op , GpuElemwise ) or isinstance ( op , tensor . Elemwise ) ) : if isinstance ( op . scalar_op , theano . scalar . Composite ) : scals = get_all_basic_scalar ( op . scalar_op ) for s in scals : if any ( [ ( i . type . dtype not in elemwise_cuda_dtype_supported ) for i in ( s . inputs + s . outputs ) ] ) : return False return True
return true of the elemwise op is supported on the gpu .