code: def main(args):
      funsor.set_backend("torch")
      if (
          args.force
          or not args.metrics_filename
          or not os.path.exists(args.metrics_filename)
      ):
          # Increase compression threshold for numerical stability.
          with funsor.gaussian.Gaussian.set_compression_threshold(3):
              results = track(args)
      else:
          results = torch.load(args.metrics_filename)
  
      if args.plot_filename:
          import matplotlib
  
          matplotlib.use("Agg")
          import numpy as np
          from matplotlib import pyplot
  
          seeds = set(seed for seed, _, _ in results)
          X = args.num_frames
          pyplot.figure(figsize=(5, 1.4), dpi=300)
  
          pos_error = np.array(
              [
                  [results[s, 0, f]["final_pos_error"] for s in seeds]
                  for f in args.num_frames
              ]
          )
          mse = (pos_error**2).mean(axis=1)
          std = (pos_error**2).std(axis=1) / len(seeds) ** 0.5
          pyplot.plot(X, mse**0.5, "k--")
          pyplot.fill_between(
              X,
              (mse - std) ** 0.5,
              (mse + std) ** 0.5,
              color="black",
              alpha=0.15,
              lw=0,
          )
  
          pos_error = np.array(
              [
                  [results[s, 1, f]["final_pos_error"] for s in seeds]
                  for f in args.num_frames
              ]
          )
          mse = (pos_error**2).mean(axis=1)
          std = (pos_error**2).std(axis=1) / len(seeds) ** 0.5
          pyplot.plot(X, mse**0.5, "r-")
          pyplot.fill_between(
              X,
              (mse - std) ** 0.5,
              (mse + std) ** 0.5,
              color="red",
              alpha=0.15,
              lw=0,
          )
  
          pyplot.ylabel("Position RMSE")
          pyplot.xlabel("Track Length")
          pyplot.xticks((5, 10, 15, 20, 25, 30))
          pyplot.xlim(5, 30)
          pyplot.tight_layout(0)
          pyplot.savefig(args.plot_filename)
  
imports: import argparse
  import itertools
  import math
  import os
  import pyro.distributions
  import torch
  import torch.nn
  from torch.optim import Adam
  import funsor
  import funsor.ops
  import funsor.torch.distributions
  from funsor.domains import Reals
  from funsor.pyro.convert import dist_to_funsor, funsor_to_mvn
  from funsor.tensor import Tensor, Variable
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types