code: def talbot(self, F, t, s):
      if get_backend() == "torch":
          import torch
  
          k = torch.arange(1, self.num_steps)
          delta = torch.zeros(self.num_steps, dtype=torch.complex64)
          delta[0] = 2 * self.num_steps / 5
          delta[1:] = (
              2
              * math.pi
              / 5
              * k
              * (1 / (math.pi / self.num_steps * k).tan() + 1j)
          )
  
          gamma = torch.zeros(self.num_steps, dtype=torch.complex64)
          gamma[0] = 0.5 * delta[0].exp()
          gamma[1:] = (
              1
              + 1j
              * math.pi
              / self.num_steps
              * k
              * (1 + 1 / (math.pi / self.num_steps * k).tan() ** 2)
              - 1j / (math.pi / self.num_steps * k).tan()
          ) * delta[1:].exp()
  
          delta = Tensor(delta)["num_steps"]
          gamma = Tensor(gamma)["num_steps"]
          ilt = (
              0.4
              / t
              * (gamma * F(**{s.name: delta / t})).reduce(
                  ops.add, "num_steps"
              )
          )
  
          return Tensor(ilt.data.real, ilt.inputs)
      else:
          raise NotImplementedError(
              f"Unsupported backend {get_backend()}"
          )
  
file_path: funsor/examples/talbot.py
imports: import argparse
  import math
  import torch
  import funsor
  import funsor.ops
  from funsor.adam import Adam
  from funsor.domains import Real
  from funsor.factory import Bound, Fresh, Has, make_funsor
  from funsor.interpretations import StatefulInterpretation
  from funsor.tensor import Tensor
  from funsor.terms import Funsor, Variable
  from funsor.util import get_backend
label_desc: Use image node_id 2 for calling a global function with example usage: talbot(F, t, s) and returns: Tensor