def var_label(var, precision=3):
 if (var.name is not None):
  return var.name
 elif isinstance(var, gof.Constant):
  h = np.asarray(var.data)
  is_const = False
  if (h.ndim == 0):
   is_const = True
   h = np.array([h])
  dstr = np.array2string(h, precision=precision)
  if ('\n' in dstr):
   dstr = dstr[:dstr.index('\n')]
  if is_const:
   dstr = dstr.replace('[', '').replace(']', '')
  return dstr
 else:
  return type_to_str(var.type)

def var_label ( var , precision = 3 ) : if ( var . name is not None ) : return var . name elif isinstance ( var , gof . Constant ) : h = np . asarray ( var . data ) is_const = False if ( h . ndim == 0 ) : is_const = True h = np . array ( [ h ] ) dstr = np . array2string ( h , precision = precision ) if ( '\n' in dstr ) : dstr = dstr [ : dstr . index ( '\n' ) ] if is_const : dstr = dstr . replace ( '[' , '' ) . replace ( ']' , '' ) return dstr else : return type_to_str ( var . type )
return label of variable node .