code: def report_final_result(metric: TrialMetric | dict[str, Any]) -> None:
      """
      Reports final result to NNI.
  
      ``metric`` should either be a float, or a dict that ``metric['default']`` is a float.
  
      If ``metric`` is a dict, ``metric['default']`` will be used by tuner,
      and other items can be visualized with web portal.
  
      Typically ``metric`` is the final accuracy or loss.
  
      Parameters
      ----------
      metric : :class:`~nni.typehint.TrialMetric`
          The final result.
      """
      assert (
          _params or trial_env_vars.NNI_PLATFORM is None
      ), "nni.get_next_parameter() needs to be called before report_final_result"
      get_default_trial_command_channel().send_metric(
          parameter_id=_params["parameter_id"] if _params else None,
          trial_job_id=trial_env_vars.NNI_TRIAL_JOB_ID,
          type="FINAL",
          sequence=0,
          value=cast(TrialMetric, metric),
      )
  
file_path: nni/nni/trial.py
imports: from __future__ import annotations
  from typing import Any, cast
  from .runtime.env_vars import trial_env_vars
  from .runtime.trial_command_channel import get_default_trial_command_channel
  from .typehint import Parameters, TrialMetric, ParameterRecord
label_desc: Use image node_id 9 for calling a global function with example usage: report_final_result(metric) without return types