def gpu_safe_new(x, tag=''):
 if (hasattr(x, 'name') and (x.name is not None)):
  nw_name = (x.name + tag)
 else:
  nw_name = None
 if isinstance(x, theano.Constant):
  return x.clone()
 nw_x = x.type()
 nw_x.name = nw_name
 return nw_x

def gpu_safe_new ( x , tag = '' ) : if ( hasattr ( x , 'name' ) and ( x . name is not None ) ) : nw_name = ( x . name + tag ) else : nw_name = None if isinstance ( x , theano . Constant ) : return x . clone ( ) nw_x = x . type ( ) nw_x . name = nw_name return nw_x
internal function that constructs a new variable from x with the same type .