(
    parameters,
    module_objective_fn,
    init_loop_variables_mapping,
    final_loop_variables_mapping,
)
return NetworkCriticalityAnalysis(
      network_criticality_score=network_criticality,
      module_criticality_analyses=dict(
          zip(
              (layer.name for layer in parameters),
              module_criticality_analyses,
          )))
Compute the criticality of a network parameterized by `parameters`.
Compute the criticality of a network parameterized by `parameters`.
Compute the criticality of a network parameterized by parameters .
def compute_network_criticality(
    parameters,
    module_objective_fn,
    init_loop_variables_mapping,
    final_loop_variables_mapping,
):
  """Compute the criticality of a network parameterized by `parameters`."""

  def _module_criticality_by_ref(layer_ref):
    return compute_module_criticality(
        functools.partial(
            module_objective_fn,
            module_variable_refs_=(layer_ref,),
        ),
        (init_loop_variables_mapping[layer_ref],),
        (final_loop_variables_mapping[layer_ref],),
    )

  layer_refs = tuple(layer.experimental_ref() for layer in parameters)
  module_criticality_analyses = map(_module_criticality_by_ref, layer_refs)
  network_criticality = sum(
      module_criticality_analysis.criticality_score
      for module_criticality_analysis in module_criticality_analyses)

  return NetworkCriticalityAnalysis(
      network_criticality_score=network_criticality,
      module_criticality_analyses=dict(
          zip(
              (layer.name for layer in parameters),
              module_criticality_analyses,
          )))
def compute_network_criticality ( parameters , module_objective_fn , init_loop_variables_mapping , final_loop_variables_mapping , ) : def _module_criticality_by_ref ( layer_ref ) : return compute_module_criticality ( functools . partial ( module_objective_fn , module_variable_refs_ = ( layer_ref , ) , ) , ( init_loop_variables_mapping [ layer_ref ] , ) , ( final_loop_variables_mapping [ layer_ref ] , ) , ) layer_refs = tuple ( layer . experimental_ref ( ) for layer in parameters ) module_criticality_analyses = map ( _module_criticality_by_ref , layer_refs ) network_criticality = sum ( module_criticality_analysis . criticality_score for module_criticality_analysis in module_criticality_analyses ) return NetworkCriticalityAnalysis ( network_criticality_score = network_criticality , module_criticality_analyses = dict ( zip ( ( layer . name for layer in parameters ) , module_criticality_analyses , ) ) )