class_docstr: Parses the inputs and outputs of `Scan` in an easy to manipulate format.
class_docstr_tok: ["Parses","the","inputs","and","outputs","of","`","Scan","`","in","an","easy","to","manipulate","format","."]
code: def __init__(
      self,
      outer_inputs: Sequence[Variable],
      outer_outputs: Sequence[Variable],
      _inner_inputs: Sequence[Variable],
      _inner_outputs: Sequence[Variable],
      info: "ScanInfo",
      clone: Optional[bool] = True,
  ):
      self.n_steps = outer_inputs[0]
      self.as_while = info.as_while
  
      if clone:
          rval = reconstruct_graph(_inner_inputs, _inner_outputs, "")
      else:
          rval = (_inner_inputs, _inner_outputs)
  
      if self.as_while:
          self.cond = [rval[1][-1]]
          inner_outputs = rval[1][:-1]
      else:
          self.cond = []
          inner_outputs = rval[1]
      inner_inputs = rval[0]
  
      p = 1
      q = 0
  
      n_seqs = info.n_seqs
      self.outer_in_seqs = list(outer_inputs[p : p + n_seqs])
      self.inner_in_seqs = list(inner_inputs[q : q + n_seqs])
      p += n_seqs
      q += n_seqs
  
      n_mit_mot = info.n_mit_mot
      n_mit_sot = info.n_mit_sot
  
      self.mit_mot_in_slices = info.mit_mot_in_slices
      self.mit_sot_in_slices = info.mit_sot_in_slices
      self.sit_sot_in_slices = info.sit_sot_in_slices
  
      n_mit_mot_ins = sum(len(s) for s in self.mit_mot_in_slices)
      n_mit_sot_ins = sum(len(s) for s in self.mit_sot_in_slices)
  
      iimm = inner_inputs[q : q + n_mit_mot_ins]
      self.inner_in_mit_mot = []
      qq = 0
      for sl in self.mit_mot_in_slices:
          self.inner_in_mit_mot.append(iimm[qq : qq + len(sl)])
          qq += len(sl)
      q += n_mit_mot_ins
  
      iims = inner_inputs[q : q + n_mit_sot_ins]
      self.inner_in_mit_sot = []
      qq = 0
      for sl in self.mit_sot_in_slices:
          self.inner_in_mit_sot.append(iims[qq : qq + len(sl)])
          qq += len(sl)
      q += n_mit_sot_ins
  
      self.outer_in_mit_mot = list(outer_inputs[p : p + n_mit_mot])
      p += n_mit_mot
      self.outer_in_mit_sot = list(outer_inputs[p : p + n_mit_sot])
      p += n_mit_sot
  
      n_sit_sot = info.n_sit_sot
      self.outer_in_sit_sot = list(outer_inputs[p : p + n_sit_sot])
      self.inner_in_sit_sot = list(inner_inputs[q : q + n_sit_sot])
      p += n_sit_sot
      q += n_sit_sot
  
      n_shared_outs = info.n_shared_outs
      self.outer_in_shared = list(outer_inputs[p : p + n_shared_outs])
      self.inner_in_shared = list(inner_inputs[q : q + n_shared_outs])
      p += n_shared_outs
      q += n_shared_outs
  
      n_nit_sot = info.n_nit_sot
      self.outer_in_nit_sot = list(outer_inputs[p : p + n_nit_sot])
      p += n_nit_sot
  
      self.outer_in_non_seqs = list(outer_inputs[p:])
      self.inner_in_non_seqs = list(inner_inputs[q:])
  
      # now for the outputs
      p = 0
      q = 0
  
      self.mit_mot_out_slices = info.mit_mot_out_slices
      n_mit_mot_outs = info.n_mit_mot_outs
      self.outer_out_mit_mot = list(outer_outputs[p : p + n_mit_mot])
      iomm = list(inner_outputs[q : q + n_mit_mot_outs])
      self.inner_out_mit_mot: tuple[list[Variable], ...] = ()
      qq = 0
      for sl in self.mit_mot_out_slices:
          self.inner_out_mit_mot += (iomm[qq : qq + len(sl)],)
          qq += len(sl)
      p += n_mit_mot
      q += n_mit_mot_outs
  
      self.outer_out_mit_sot = list(outer_outputs[p : p + n_mit_sot])
      self.inner_out_mit_sot = list(inner_outputs[q : q + n_mit_sot])
      p += n_mit_sot
      q += n_mit_sot
  
      self.outer_out_sit_sot = list(outer_outputs[p : p + n_sit_sot])
      self.inner_out_sit_sot = list(inner_outputs[q : q + n_sit_sot])
      p += n_sit_sot
      q += n_sit_sot
  
      self.outer_out_nit_sot = list(outer_outputs[p : p + n_nit_sot])
      self.inner_out_nit_sot = list(inner_outputs[q : q + n_nit_sot])
      p += n_nit_sot
      q += n_nit_sot
  
      self.outer_out_shared = list(outer_outputs[p : p + n_shared_outs])
      self.inner_out_shared = list(inner_outputs[q : q + n_shared_outs])
      p += n_shared_outs
      q += n_shared_outs
  
      assert p == len(outer_outputs)
      assert q == len(inner_outputs)
  
imports: import copy
  import dataclasses
  import logging
  from collections import OrderedDict, namedtuple
  from collections.abc import Sequence
  from itertools import chain
  from typing import TYPE_CHECKING, Callable, Optional, Union
  from typing import cast
  import numpy
  from pytensor import scalar
  from pytensor import tensor
  from pytensor.compile.profiling import ProfileStats
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Constant, Variable, equal_computations, graph_inputs
  from pytensor.graph.op import get_test_value
  from pytensor.graph.replace import clone_replace
  from pytensor.graph.type import HasDataType
  from pytensor.graph.utils import TestValueError
  from pytensor.tensor.basic import AllocEmpty, cast
  from pytensor.tensor.subtensor import set_subtensor
  from pytensor.tensor.variable import TensorConstant
label_desc: Use image node_id 1 to create a new ScanArgs object  with example: obj = ScanArgs(outer_inputs, outer_outputs, _inner_inputs, _inner_outputs, info, clone)