parameters: (x, *reference, dtype=None, device=None)
return_statement: return x
docstring: Convert something to 1D tensor. Support following types
  
        * sequence of scalar literal / tensor
        * numpy array
        * tensor (returned as is, regardless of dtype and device)
docstring_summary: Convert something to 1D tensor. Support following types
docstring_tokens: Convert something to 1D tensor . Support following types
function: def astensor1d(x, *reference, dtype=None, device=None):
      """Convert something to 1D tensor. Support following types
  
        * sequence of scalar literal / tensor
        * numpy array
        * tensor (returned as is, regardless of dtype and device)
      """
      try:
          ndim = x.ndim
      except AttributeError:
          pass
      except ValueError:
          if dtype is not None and dtype != x.dtype:
              x = astype(x, dtype)
          if device is not None:
              cn = as_device(device).to_c()
              (x,) = apply(builtin.Copy(comp_node=cn), x)
          return x
      else:
          if ndim != 0 and ndim != 1:
              raise ValueError("ndim != 1 or 0, get : %d" % ndim)
          if not isinstance(x, (Tensor, SymbolVar)):
              (x,) = Const(x, dtype=dtype, device=device)(*reference)
          return x
  
      if not isinstance(x, collections.abc.Sequence):
          raise TypeError
  
      if any(isinstance(i, (Tensor, SymbolVar)) for i in x):
          x = concatenate(x, device=device) if len(x) > 1 else x[0]
          if dtype is not None:
              x = astype(x, dtype)
          return x
      (x,) = Const(x, dtype=dtype, device=device)(*reference)
      return x
function_tokens: def astensor1d ( x , * reference , dtype = None , device = None ) : try : ndim = x . ndim except AttributeError : pass except ValueError : if dtype is not None and dtype != x . dtype : x = astype ( x , dtype ) if device is not None : cn = as_device ( device ) . to_c ( ) ( x , ) = apply ( builtin . Copy ( comp_node = cn ) , x ) return x else : if ndim != 0 and ndim != 1 : raise ValueError ( "ndim != 1 or 0, get : %d" % ndim ) if not isinstance ( x , ( Tensor , SymbolVar ) ) : ( x , ) = Const ( x , dtype = dtype , device = device ) ( * reference ) return x if not isinstance ( x , collections . abc . Sequence ) : raise TypeError if any ( isinstance ( i , ( Tensor , SymbolVar ) ) for i in x ) : x = concatenate ( x , device = device ) if len ( x ) > 1 else x [ 0 ] if dtype is not None : x = astype ( x , dtype ) return x ( x , ) = Const ( x , dtype = dtype , device = device ) ( * reference ) return x