docstr: Check all nodes' channel dimensions against parents and children to make sure they agree; e.g. flatten ops may change these dimensions
code: def enforce_dimension_agreement(cls, fx_graph):
      """Check all nodes' channel dimensions against parents and children to make sure they agree; e.g. flatten ops may change these dimensions"""
  
      if cls.__verbosity > 0:
          print("[enforce_dimension_agreement]")
  
      for node_name in fx_graph.keys():
          fx_node = fx_graph[node_name]
          if "is_real" in fx_node.keys() and fx_node["is_real"]:
              # enforce this node's input dimension matches its parents' output dimensions
              node_C = int(fx_node["C_param"])
              node_K = int(fx_node["K_param"])
  
              if fx_graph[node_name]["groups_param"] not in [
                  "1",
                  "None",
              ]:
                  node_C = node_C * int(fx_node["groups_param"])
  
              node_real_parents = fx_node["real_parents"]
              if len(node_real_parents) == 0:
                  if cls.__verbosity > 1:
                      print(
                          f"\t{node_name} has no real parents, disabling permutations along C"
                      )
                  fx_graph[node_name]["C_permutable"] = False
              else:
                  for real_parent in node_real_parents:
                      parent_K = int(fx_graph[real_parent]["K_param"])
                      ignore_mismatch = fx_graph[real_parent].get(
                          "allow_K_mismatch"
                      )
  
                      if ignore_mismatch is not None:
                          if cls.__verbosity > 1:
                              print(
                                  f"\tIgnoring dimension mismatch between {node_name} (C={node_C}) and its parent {real_parent} (K={parent_K}) as requested: {ignore_mismatch}"
                              )
  
                      elif parent_K >= 0 and node_C != parent_K:
                          if cls.__verbosity > 1:
                              print(
                                  f"\tDimensions mismatch between {node_name} (C={node_C}) and its parent {real_parent} (K={parent_K}), disallowing the relevant permutations"
                              )
  
                          fx_graph[node_name]["C_permutable"] = False
                          fx_graph[real_parent]["K_permutable"] = False
  
                          if cls.__verbosity > 2:
                              print(
                                  f"\t{fx_graph[node_name]}\n\t{fx_graph[real_parent]}"
                              )
  
              if len(fx_graph[node_name]["real_children"]) == 0:
                  if cls.__verbosity > 1:
                      print(
                          f"\t{node_name} has no real children, disabling permutations along K"
                      )
                  fx_graph[node_name]["K_permutable"] = False
  
      return fx_graph
  
imports: import os
  import torch
  import json
  import string
  import time
  import numpy
  import sys
  import builtins
  import io
label_desc: Use image node_id 32 for calling the Permutation obj's underlying member method code with example usage: obj.enforce_dimension_agreement(cls, fx_graph) and returns: fx_graph