def as_op(itypes, otypes, infer_shape=None):
 if (not isinstance(itypes, (list, tuple))):
  itypes = [itypes]
 if any(((not isinstance(t, theano.Type)) for t in itypes)):
  raise TypeError('itypes has to be a list of Theano types')
 if (not isinstance(otypes, (list, tuple))):
  otypes = [otypes]
 if any(((not isinstance(t, theano.Type)) for t in otypes)):
  raise TypeError('otypes has to be a list of Theano types')
 itypes = list(itypes)
 otypes = list(otypes)
 if ((infer_shape is not None) and (not callable(infer_shape))):
  raise TypeError('infer_shape needs to be a callable')
 def make_op(fn):
  return FromFunctionOp(fn, itypes, otypes, infer_shape)
 return make_op

def as_op ( itypes , otypes , infer_shape = None ) : if ( not isinstance ( itypes , ( list , tuple ) ) ) : itypes = [ itypes ] if any ( ( ( not isinstance ( t , theano . Type ) ) for t in itypes ) ) : raise TypeError ( 'itypes has to be a list of Theano types' ) if ( not isinstance ( otypes , ( list , tuple ) ) ) : otypes = [ otypes ] if any ( ( ( not isinstance ( t , theano . Type ) ) for t in otypes ) ) : raise TypeError ( 'otypes has to be a list of Theano types' ) itypes = list ( itypes ) otypes = list ( otypes ) if ( ( infer_shape is not None ) and ( not callable ( infer_shape ) ) ) : raise TypeError ( 'infer_shape needs to be a callable' ) def make_op ( fn ) : return FromFunctionOp ( fn , itypes , otypes , infer_shape ) return make_op
decorator that converts a function into a basic theano op that will call the supplied function as its implementation .