def join_nonshared_inputs(xs, vars, shared, make_shared=False):
 joined = tt.concatenate([var.ravel() for var in vars])
 if (not make_shared):
  tensor_type = joined.type
  inarray = tensor_type('inarray')
 else:
  inarray = theano.shared(joined.tag.test_value, 'inarray')
 ordering = ArrayOrdering(vars)
 inarray.tag.test_value = joined.tag.test_value
 get_var = {var.name: var for var in vars}
 replace = {get_var[var]: reshape_t(inarray[slc], shp).astype(dtyp) for (var, slc, shp, dtyp) in ordering.vmap}
 replace.update(shared)
 xs_special = [theano.clone(x, replace, strict=False) for x in xs]
 return (xs_special, inarray)

def join_nonshared_inputs ( xs , vars , shared , make_shared = False ) : joined = tt . concatenate ( [ var . ravel ( ) for var in vars ] ) if ( not make_shared ) : tensor_type = joined . type inarray = tensor_type ( 'inarray' ) else : inarray = theano . shared ( joined . tag . test_value , 'inarray' ) ordering = ArrayOrdering ( vars ) inarray . tag . test_value = joined . tag . test_value get_var = { var . name : var for var in vars } replace = { get_var [ var ] : reshape_t ( inarray [ slc ] , shp ) . astype ( dtyp ) for ( var , slc , shp , dtyp ) in ordering . vmap } replace . update ( shared ) xs_special = [ theano . clone ( x , replace , strict = False ) for x in xs ] return ( xs_special , inarray )
takes a list of theano variables and joins their non shared inputs into a single input .