docs: def update_optimiser(context, *args, **kwargs) -> None:
      """
      Writes optimiser state into corresponding TensorFlow variables. This may need to be done
      for optimisers like ScipyOptimiser that work with their own copies of the variables.
      Normally the source variables would be updated only when the optimiser has finished the
      minimisation. This function may be called from the callback in order to get the TensorFlow
      variables up-to-date so that they can be written into TensorBoard for example.
  
      The expected state parameters and the procedure of writing them into variables is specific
      to each optimiser. Currently it is implemented only for ScipyOptimiser.
  
      After the state is updated a flag is set to the context to prevent multiple updates in
      the same callback.
  
      :param context: Monitor context
      :param args: Optimiser's state passed to the callback
      :param kwargs: Optimiser's state passed to the callback
      """
  
      if context.optimiser is None or context.optimiser_updated:
          return
  
      if isinstance(context.optimiser, ScipyOptimizer) and len(args) > 0:
  
          optimizer = context.optimiser.optimizer  # get access to ExternalOptimizerInterface
          var_vals = [args[0][packing_slice] for packing_slice in optimizer._packing_slices]
          context.session.run(optimizer._var_updates,
                              feed_dict=dict(zip(optimizer._update_placeholders, var_vals)))
          context.optimiser_updated = True