code: def test_model_graph_with_intermediate_named_variables():
      # Issue 6421
      with pm.Model() as m1:
          a = pm.Normal("a", 0, 1, shape=3)
          pm.Normal("b", a.mean(axis=-1), 1)
      assert dict(ModelGraph(m1).make_compute_graph()) == {
          "a": set(),
          "b": {"a"},
      }
  
      with pm.Model() as m2:
          a = pm.Normal("a", 0, 1)
          b = a + 1
          b.name = "b"
          pm.Normal("c", b, 1)
      assert dict(ModelGraph(m2).make_compute_graph()) == {
          "a": set(),
          "c": {"a"},
      }
  
imports: import warnings
  import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  from pytensor.compile.sharedvalue import SharedVariable
  from pytensor.tensor.variable import TensorConstant
  import pymc
  from pymc.exceptions import ImputationWarning
  from pymc.model_graph import ModelGraph, model_to_graphviz, model_to_networkx
label_desc: Use image node_id 9 for calling a global function with example usage: test_model_graph_with_intermediate_named_variables() without return types