code: def get_num_controls_from_policies(policies):
      """
      Calculates the ``list`` of dimensionalities of control factors (``num_controls``)
      from the ``list`` or array of policies. This assumes a policy space such that for each control factor, there is at least
      one policy that entails taking the action with the maximum index along that control factor.
  
      Parameters
      ----------
      policies: ``list`` of 2D ``numpy.ndarray``
          ``list`` that stores each policy as a 2D array in ``policies[p_idx]``. Shape of ``policies[p_idx]``
          is ``(num_timesteps, num_factors)`` where ``num_timesteps`` is the temporal
          depth of the policy and ``num_factors`` is the number of control factors.
  
      Returns
      ----------
      num_controls: ``list`` of ``int``
          ``list`` of the dimensionalities of each control state factor, computed here automatically from a ``list`` of policies.
      """
  
      return list(np.max(np.vstack(policies), axis=0) + 1)
  
imports: import itertools
  import numpy
  from pymdp.maths import softmax, softmax_obj_arr, spm_dot, spm_wnorm, spm_MDP_G, spm_log_single, spm_log_obj_array
  from pymdp import utils
  import copy
label_desc: Use image node_id 10 for calling a global function with example usage: get_num_controls_from_policies(policies) and returns: list