parameters: (self, op, grad)
return_statement: return ops.IndexedSlices(
          indices=acc_exits[0], values=acc_exits[1],
          dense_shape=acc_exits[2] if shape_acc is not None else None)
docstring: This is used for accumulating gradients that are IndexedSlices.
  
      This is essentially the equavalent of AddBackPropAccumulator but optimized
      for things like updating embeddings from within a while loop.
  
      Args:
        op: The Enter op for a loop invariant.
        grad: The partial gradients represented as an IndexedSlices.
  
      Returns:
        The accumulated IndexedSlices gradient of the loop invariant.
docstring_summary: This is used for accumulating gradients that are IndexedSlices.
docstring_tokens: This is used for accumulating gradients that are IndexedSlices .
function: def AddBackPropIndexedSlicesAccumulator(self, op, grad):
      """This is used for accumulating gradients that are IndexedSlices.
  
      This is essentially the equavalent of AddBackPropAccumulator but optimized
      for things like updating embeddings from within a while loop.
  
      Args:
        op: The Enter op for a loop invariant.
        grad: The partial gradients represented as an IndexedSlices.
  
      Returns:
        The accumulated IndexedSlices gradient of the loop invariant.
      """
      values = grad.values
      indices = grad.indices
      dense_shape = grad.dense_shape
  
      self.Exit()
      if self.outer_context: self.outer_context.Enter()
      if values.get_shape().is_fully_defined():
        values_shape = tensor_shape.TensorShape(
            [tensor_shape.Dimension(1)] + values.get_shape().dims[1:])
        if self.outer_context: self.outer_context.Enter()
        values_acc = constant_op.constant(0, values.dtype, shape=values_shape,
                                          name="b_acc")
        if self.outer_context: self.outer_context.Exit()
      else:
        values_shape = array_ops.shape_internal(op.inputs[0], optimize=False)[1:]
        values_shape = array_ops.concat(0, [[1], values_shape])
        values_acc = array_ops.zeros(values_shape, dtype=values.dtype)
      indices_acc = constant_op.constant([0], indices.dtype)
      shape_acc = None
      if dense_shape is not None:
        if dense_shape.get_shape().is_fully_defined():
          if self.outer_context: self.outer_context.Enter()
          shape_acc = constant_op.constant(0, dense_shape.dtype,
                                           shape=dense_shape.get_shape())
          if self.outer_context: self.outer_context.Exit()
        else:
          shape_acc = array_ops.zeros_like(
              array_ops.shape_internal(op.inputs[0], optimize=False),
              optimize=False)
  
      if self.outer_context: self.outer_context.Exit()
  
      self.Enter()
      self.AddName(values_acc.name)
      self.AddName(indices_acc.name)
      init_acc = [indices_acc, values_acc]
      if shape_acc is not None:
        self.AddName(shape_acc.name)
        init_acc.append(shape_acc)
      enter_acc = [_Enter(x, self._name, is_constant=False,
                          parallel_iterations=self._parallel_iterations,
                          name="b_acc") for x in init_acc]
      merge_acc = [merge([x, x], name="b_acc")[0] for x in enter_acc]
      switch_acc = [switch(x, self._pivot) for x in merge_acc]
  
      # The actual accumulation.
      acc_indexed_slices = [array_ops.concat(0, [xa[1], xv])
                            for xa, xv in zip(switch_acc[:2], [indices, values])]
      if shape_acc is not None:
        # For the shape we just keep the maximum
        acc_indexed_slices.append(
            math_ops.maximum(dense_shape, switch_acc[2][1]))
  
      next_acc = [_NextIteration(x) for x in acc_indexed_slices]
      for xm, xn in zip(merge_acc, next_acc):
        xm.op._update_input(1, xn)  # pylint: disable=protected-access
  
      acc_exits = [exit(x[0], name="b_acc") for x in switch_acc]
  
      self.ExitResult(acc_exits)
      return ops.IndexedSlices(
          indices=acc_exits[0], values=acc_exits[1],
          dense_shape=acc_exits[2] if shape_acc is not None else None)
function_tokens: def AddBackPropIndexedSlicesAccumulator ( self , op , grad ) : values = grad . values indices = grad . indices dense_shape = grad . dense_shape self . Exit ( ) if self . outer_context : self . outer_context . Enter ( ) if values . get_shape ( ) . is_fully_defined ( ) : values_shape = tensor_shape . TensorShape ( [ tensor_shape . Dimension ( 1 ) ] + values . get_shape ( ) . dims [ 1 : ] ) if self . outer_context : self . outer_context . Enter ( ) values_acc = constant_op . constant ( 0 , values . dtype , shape = values_shape , name = "b_acc" ) if self . outer_context : self . outer_context . Exit ( ) else : values_shape = array_ops . shape_internal ( op . inputs [ 0 ] , optimize = False ) [ 1 : ] values_shape = array_ops . concat ( 0 , [ [ 1 ] , values_shape ] ) values_acc = array_ops . zeros ( values_shape , dtype = values . dtype ) indices_acc = constant_op . constant ( [ 0 ] , indices . dtype ) shape_acc = None if dense_shape is not None : if dense_shape . get_shape ( ) . is_fully_defined ( ) : if self . outer_context : self . outer_context . Enter ( ) shape_acc = constant_op . constant ( 0 , dense_shape . dtype , shape = dense_shape . get_shape ( ) ) if self . outer_context : self . outer_context . Exit ( ) else : shape_acc = array_ops . zeros_like ( array_ops . shape_internal ( op . inputs [ 0 ] , optimize = False ) , optimize = False ) if self . outer_context : self . outer_context . Exit ( ) self . Enter ( ) self . AddName ( values_acc . name ) self . AddName ( indices_acc . name ) init_acc = [ indices_acc , values_acc ] if shape_acc is not None : self . AddName ( shape_acc . name ) init_acc . append ( shape_acc ) enter_acc = [ _Enter ( x , self . _name , is_constant = False , parallel_iterations = self . _parallel_iterations , name = "b_acc" ) for x in init_acc ] merge_acc = [ merge ( [ x , x ] , name = "b_acc" ) [ 0 ] for x in enter_acc ] switch_acc = [ switch ( x , self . _pivot ) for x in merge_acc ] # The actual accumulation. acc_indexed_slices = [ array_ops . concat ( 0 , [ xa [ 1 ] , xv ] ) for xa , xv in zip ( switch_acc [ : 2 ] , [ indices , values ] ) ] if shape_acc is not None : # For the shape we just keep the maximum acc_indexed_slices . append ( math_ops . maximum ( dense_shape , switch_acc [ 2 ] [ 1 ] ) ) next_acc = [ _NextIteration ( x ) for x in acc_indexed_slices ] for xm , xn in zip ( merge_acc , next_acc ) : xm . op . _update_input ( 1 , xn ) # pylint: disable=protected-access acc_exits = [ exit ( x [ 0 ] , name = "b_acc" ) for x in switch_acc ] self . ExitResult ( acc_exits ) return ops . IndexedSlices ( indices = acc_exits [ 0 ] , values = acc_exits [ 1 ] , dense_shape = acc_exits [ 2 ] if shape_acc is not None else None )