class_docstr: A collection of remote modules (of type RemoteModule) with connections showing how inputs
  to the model or outputs of individual modules are use as inputs of subsequent modules.
  The graph has a number of helper functions that add new modules to the graph and define inputs
  to these module.
docstr: Adds a list of modules to the graph, to be run sequentially.
  The connection between these modules is as follows: the output of each of these modules
  (except the last one) is used as the input of its next module in this sequence.
  So all modules (except the last one) must have simple output, and also all of them (except the first one)
  should have a single input.
  The user also specifies the input to the first module in this sequence with argument 'first_module_inputs'.
  In case the last module output is a tuple, 'last_module_num_outputs' specifies the number of elements
  in the tuple.
docstr_tok: ["Adds","a","list","of","modules","to","the","graph",",","to","be","run","sequentially",".","The","connection","between","these","modules","is","as","follows",":","the","output","of","each","of","these","modules","(","except","the","last","one",")","is","used","as","the","input","of","its","next","module","in","this","sequence",".","So","all","modules","(","except","the","last","one",")","must","have","simple","output",",","and","also","all","of","them","(","except","the","first","one",")","should","have","a","single","input",".","The","user","also","specifies","the","input","to","the","first","module","in","this","sequence","with","argument","'first_module_inputs","'",".","In","case","the","last","module","output","is","a","tuple",",","'last_module_num_outputs","'","specifies","the","number","of","elements","in","the","tuple","."]
code: def add_sequence(
      self,
      modules: List[RemoteModule],
      first_module_inputs: List[DataSourceSpec],
      last_module_num_outputs: Optional[int] = None,
  ) -> None:
      """Adds a list of modules to the graph, to be run sequentially.
      The connection between these modules is as follows: the output of each of these modules
      (except the last one) is used as the input of its next module in this sequence.
      So all modules (except the last one) must have simple output, and also all of them (except the first one)
      should have a single input.
      The user also specifies the input to the first module in this sequence with argument 'first_module_inputs'.
      In case the last module output is a tuple, 'last_module_num_outputs' specifies the number of elements
      in the tuple.
      """
      next_input = first_module_inputs
      for i, module in enumerate(modules):
          self.add_layer(
              module,
              next_input,
              last_module_num_outputs
              if i == len(modules) - 1
              else None,
          )
          next_input = [module]
  
imports: from dataclasses import dataclass
  from typing import List, Optional, Set, Tuple, Union
  from torch import Tensor, nn
  from torch.distributed import rpc
  from torch.distributed.nn import RemoteModule
  from .data import DataConsumer
label_desc: Use image node_id 6 for calling the PipelineModulesGraph obj's underlying member method code with example usage: obj.add_sequence(modules, first_module_inputs, last_module_num_outputs) without return types