parameters: (self, *args)
return_statement: return tuple(variable_args)
docstring: Argument convert args to Variable
  
          Args:
              value (float, list, numpy.ndarray, Variable)
          Returns:
              Variable of args.
docstring_summary: Argument convert args to Variable
docstring_tokens: Argument convert args to Variable
function: def _to_variable(self, *args):
          """
          Argument convert args to Variable
  
          Args:
              value (float, list, numpy.ndarray, Variable)
          Returns:
              Variable of args.
          """
          numpy_args = []
          variable_args = []
          tmp = 0.
  
          for arg in args:
              valid_arg = False
              for cls in [float, list, np.ndarray, tensor.Variable]:
                  if isinstance(arg, cls):
                      valid_arg = True
                      break
              assert valid_arg, "type of input args must be float, list, numpy.ndarray or Variable."
              if isinstance(arg, float):
                  arg = np.zeros(1) + arg
              arg_np = np.array(arg)
              arg_dtype = arg_np.dtype
              if str(arg_dtype) not in ['float32']:
                  warnings.warn(
                      "data type of argument only support float32, your argument will be convert to float32."
                  )
                  arg_np = arg_np.astype('float32')
              tmp = tmp + arg_np
              numpy_args.append(arg_np)
  
          dtype = tmp.dtype
          for arg in numpy_args:
              arg_broadcasted, _ = np.broadcast_arrays(arg, tmp)
              arg_variable = tensor.create_tensor(dtype=dtype)
              tensor.assign(arg_broadcasted, arg_variable)
              variable_args.append(arg_variable)
  
          return tuple(variable_args)
function_tokens: def _to_variable ( self , * args ) : numpy_args = [ ] variable_args = [ ] tmp = 0. for arg in args : valid_arg = False for cls in [ float , list , np . ndarray , tensor . Variable ] : if isinstance ( arg , cls ) : valid_arg = True break assert valid_arg , "type of input args must be float, list, numpy.ndarray or Variable." if isinstance ( arg , float ) : arg = np . zeros ( 1 ) + arg arg_np = np . array ( arg ) arg_dtype = arg_np . dtype if str ( arg_dtype ) not in [ 'float32' ] : warnings . warn ( "data type of argument only support float32, your argument will be convert to float32." ) arg_np = arg_np . astype ( 'float32' ) tmp = tmp + arg_np numpy_args . append ( arg_np ) dtype = tmp . dtype for arg in numpy_args : arg_broadcasted , _ = np . broadcast_arrays ( arg , tmp ) arg_variable = tensor . create_tensor ( dtype = dtype ) tensor . assign ( arg_broadcasted , arg_variable ) variable_args . append ( arg_variable ) return tuple ( variable_args )