parameters: (self, beta1)
docstring: init adafactor variables
docstring_summary: init adafactor variables
docstring_tokens: init adafactor variables
function: def init_ada_factor_state(self, beta1):
          """init adafactor variables"""
          if beta1 > 0:
              self.use_first_moment = True
              self.exp_avg = self.parameters.clone(prefix="exp_avg", init='zeros')
          else:
              self.use_first_moment = False
              self.exp_avg = ParameterTuple([Parameter(Tensor(0.0))] * len(self.parameters))
  
          self.exp_avg_sq = []
          self.exp_avg_sq_col = []
          self.exp_avg_sq_row = []
          for param in self.parameters:
              param_dtype = param.dtype
              param_shape = param.shape
              param_name = param.name
              if len(param_shape) > 1:
                  self.exp_avg_sq_row.append(Parameter(initializer(0, shape=param_shape[:-1], dtype=param_dtype),
                                                       name="exp_avg_sq_row_{}".format(param_name)))
                  self.exp_avg_sq_col.append(Parameter(initializer(0, shape=param_shape[:-2] + param_shape[-1:],
                                                                   dtype=param_dtype),
                                                       name="exp_avg_sq_col_{}".format(param_name)))
                  self.exp_avg_sq.append(Parameter(initializer(0, shape=(1,), dtype=param_dtype),
                                                   name="exp_avg_sq_{}".format(param_name)))
  
              else:
                  self.exp_avg_sq_row.append(Parameter(initializer(0, shape=(1,), dtype=param_dtype),
                                                       name="exp_avg_sq_row_{}".format(param_name)))
                  self.exp_avg_sq_col.append(Parameter(initializer(0, shape=(1,), dtype=param_dtype),
                                                       name="exp_avg_sq_col_{}".format(param_name)))
  
                  if self.compression:
                      self.exp_avg_sq.append(Parameter(initializer(0, shape=param_shape, dtype=mstype.float16),
                                                       name="exp_avg_sq_{}".format(param_name)))
                  else:
                      self.exp_avg_sq.append(Parameter(initializer(0, shape=param_shape, dtype=param_dtype),
                                                       name="exp_avg_sq_{}".format(param_name)))
  
          self.exp_avg_sq_row = ParameterTuple(self.exp_avg_sq_row)
          self.exp_avg_sq_col = ParameterTuple(self.exp_avg_sq_col)
          self.exp_avg_sq = ParameterTuple(self.exp_avg_sq)
function_tokens: def init_ada_factor_state ( self , beta1 ) : if beta1 > 0 : self . use_first_moment = True self . exp_avg = self . parameters . clone ( prefix = "exp_avg" , init = 'zeros' ) else : self . use_first_moment = False self . exp_avg = ParameterTuple ( [ Parameter ( Tensor ( 0.0 ) ) ] * len ( self . parameters ) ) self . exp_avg_sq = [ ] self . exp_avg_sq_col = [ ] self . exp_avg_sq_row = [ ] for param in self . parameters : param_dtype = param . dtype param_shape = param . shape param_name = param . name if len ( param_shape ) > 1 : self . exp_avg_sq_row . append ( Parameter ( initializer ( 0 , shape = param_shape [ : - 1 ] , dtype = param_dtype ) , name = "exp_avg_sq_row_{}" . format ( param_name ) ) ) self . exp_avg_sq_col . append ( Parameter ( initializer ( 0 , shape = param_shape [ : - 2 ] + param_shape [ - 1 : ] , dtype = param_dtype ) , name = "exp_avg_sq_col_{}" . format ( param_name ) ) ) self . exp_avg_sq . append ( Parameter ( initializer ( 0 , shape = ( 1 , ) , dtype = param_dtype ) , name = "exp_avg_sq_{}" . format ( param_name ) ) ) else : self . exp_avg_sq_row . append ( Parameter ( initializer ( 0 , shape = ( 1 , ) , dtype = param_dtype ) , name = "exp_avg_sq_row_{}" . format ( param_name ) ) ) self . exp_avg_sq_col . append ( Parameter ( initializer ( 0 , shape = ( 1 , ) , dtype = param_dtype ) , name = "exp_avg_sq_col_{}" . format ( param_name ) ) ) if self . compression : self . exp_avg_sq . append ( Parameter ( initializer ( 0 , shape = param_shape , dtype = mstype . float16 ) , name = "exp_avg_sq_{}" . format ( param_name ) ) ) else : self . exp_avg_sq . append ( Parameter ( initializer ( 0 , shape = param_shape , dtype = param_dtype ) , name = "exp_avg_sq_{}" . format ( param_name ) ) ) self . exp_avg_sq_row = ParameterTuple ( self . exp_avg_sq_row ) self . exp_avg_sq_col = ParameterTuple ( self . exp_avg_sq_col ) self . exp_avg_sq = ParameterTuple ( self . exp_avg_sq )