code: def get_dim_from_layer_name(
      all_layers, current_layer, full_layer_name
  ):
      layer_name, auxiliary_output = split_layer_name(full_layer_name)
      for layer in all_layers:
          if layer is current_layer:
              break
  
          # If 'all_layers' contains some 'existing' layers, i.e. layers which
          # are not really layers but are actual component names from an existing
          # neural net that we are adding components to, they may already be
          # of the form 'xxx.yyy', e.g. 'tdnn1.affine'.  In this case the name of
          # the layer in 'all_layers' won't be just the 'xxx' part (e.g. 'tdnn1'),
          # it will be the full thing, like 'tdnn1.affine'.
          # We will also use the if-statement immediately below this comment for
          # regular layers, e.g. where full_layer_name is something like 'tdnn2'.
          # The if-statement below the next one, that uses
          # auxiliary_output, will only be used in the (rare) case when we are
          # using auxiliary outputs, e.g. 'lstm1.c'.
          if layer.get_name() == full_layer_name:
              return layer.output_dim()
  
          if layer.get_name() == layer_name:
              if (
                  not auxiliary_output in layer.auxiliary_outputs()
                  and auxiliary_output is not None
              ):
                  raise RuntimeError(
                      "Layer '{0}' has no such auxiliary output:"
                      "'{1}' ({0}.{1})".format(
                          layer_name, auxiliary_output
                      )
                  )
              return layer.output_dim(auxiliary_output)
      # No such layer was found.
      if layer_name in [layer.get_name() for layer in all_layers]:
          raise RuntimeError(
              "Layer '{0}' was requested before it appeared in "
              "the xconfig file (circular dependencies or out-of-order "
              "layers".format(layer_name)
          )
      else:
          raise RuntimeError("No such layer: '{0}'".format(layer_name))
  
imports: from __future__ import print_function
  from __future__ import division
  import re
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: get_dim_from_layer_name(all_layers, current_layer, full_layer_name) and returns: layer, layer