InputGraph and InputGraphRef definition in IR.
InputGraph and InputGraphRef definition in IR.

InputGraph is a general representations (graph topology) that replaces existing ResolverConfig (linear topology). It consists of multiple `ResolverOp` nodes, as specified from a resolver function.

InputGraph output can be a `List[Artifact]` type (`ARTIFACT_LIST`), `Dict[str, List[Artifact]]` type (`ARTIFACT_MULTIMAP`), and `List[Dict[str, List[Artifact]]]` type (`ARTIFACT_MULTIMAP_LIST`). Output node is selected from `InputGraphRef` along with optional "key" field.

`InputGraphRef` is used instead of directly specifying `InputGraph` per each `InputSpec`. This helps unnecessarily duplication, as well as disambiguate a single ForEach from a nested ForEach. For example,

```
with ForEach(...) as inputs:
  a = A(x=inputs['x'],
        y=inputs['y'])
```

will be translated into

```
inputs {
  key: "x"
  value {
    input_graph_ref {
      graph_id: "foreach1"
      key: "x"
    }
  }
}
inputs {
  key: "y"
  value {
    input_graph_ref {
      graph_id: "foreach1"
      key: "y"
    }
  }
}
```

whereas

```
with ForEach(...) as x:
  with ForEach(...) as y:
    a = A(x=x, y=y)
```

will be translated into

```
inputs {
  key: "x"
  value {
    input_graph_ref {
      graph_id: "foreach_outer"
      key: "x"
    }
  }
}
inputs {
  key: "y"
  value {
    input_graph_ref {
      graph_id: "foreach_inner"
      key: "y"
    }
  }
}
```

PiperOrigin-RevId: 450358542

tensorflow/tfx,tensorflow/tfx