docstr: Apply a permutation along K to the children of some node
code: def apply_permutation_in_K_dim_to_children(
      cls, fx_graph, node_name, permutation, dryrun
  ):
      """Apply a permutation along K to the children of some node"""
  
      success = True
      children = fx_graph[node_name]["children"]
      if cls.__verbosity > 2 and dryrun:
          print(
              f"Applying a permutation in K to children of {node_name} : {children}"
          )
  
      # apply the permutation along K to children as necessary
      for child in children:
          if (
              "is_real" in fx_graph[child].keys()
              and fx_graph[child]["is_real"]
          ):
              if cls.__verbosity > 3 and dryrun:
                  print(
                      f"\tFound a real child {child}, not permuting it or its children along K"
                  )
          else:
              if (
                  "module_type" not in fx_graph[child].keys()
                  or fx_graph[child]["module_type"] == "None"
              ):
                  if cls.__verbosity > 3 and dryrun:
                      print(
                          f"\tPermuting children of non-module {child} along K"
                      )
                  success = (
                      success
                      and cls.apply_permutation_in_K_dim_to_children(
                          fx_graph, child, permutation, dryrun
                      )
                  )
              elif not fx_graph[child]["C_permutable"]:
                  if (
                      fx_graph[child]["K_permutable"]
                      and not fx_graph[child]["K_permuted"]
                  ):
                      if cls.__verbosity > 2 and dryrun:
                          print(f"\tPermuting {child} along K")
                      child_permuted = cls.apply_permutation_in_K_dim(
                          child, permutation, fx_graph, dryrun
                      )
                      success = success and child_permuted
                      if not dryrun:
                          fx_graph[child]["K_permuted"] = child_permuted
                      assert fx_graph[child]["K_passthru"]
  
                  if fx_graph[child]["K_passthru"]:
                      success = (
                          success
                          and cls.apply_permutation_in_K_dim_to_children(
                              fx_graph, child, permutation, dryrun
                          )
                      )
                  else:
                      if cls.__verbosity >= 0:
                          print(
                              f"\t!! ERROR {child} was a not real module that was not K_passthru"
                          )
  
      return success
  
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 18 for calling the Permutation obj's underlying member method code with example usage: obj.apply_permutation_in_K_dim_to_children(cls, fx_graph, node_name, permutation, dryrun) and returns: success