code: def dense_factored(
      shapes,  # (shape1, shape2)
      activation=default_override_or(identity),
      init={"W1": None, "W2": None},
      input_rank=None,
      map_rank=None,
      bias=default_override_or(True),
      init_bias=default_override_or(0),
      name="",
  ):
      """
      Perform the new model creation using the factored inputs W1 and W2.
      The returend function represents the new model.
  
      Args:
          shapes                  : dimensions of the input matrices.
          activation              : activation function used for the model.
          init                    : the two matrices corresponding to the factorization.
          input_rank              : rank of the input tensor.
          map_rank                : ???
          bias                    : bias for the model.
          init_bias               : initial bias value.
          name                    : name of the block function that creates the new model.
  
      Returns:
          a model that is factored and projected (reduced).
      """
  
      # matthaip: Not sure how to handle input tensor of rank > 1
      # or selective flattening of ranks
      assert (
          input_rank is None
          and map_rank is None
          and all(isinstance(s, int) for s in list(shapes))
      )
  
      activation = get_default_override(
          cntk.layers.Dense, activation=activation
      )
      bias = get_default_override(cntk.layers.Dense, bias=bias)
      init_bias = get_default_override(
          cntk.layers.Dense, init_bias=init_bias
      )
      # how to use get_default_override for init parameeter?
  
      output_shape1 = _as_tuple(shapes[0])
      output_shape2 = _as_tuple(shapes[1])
      if input_rank is not None and map_rank is not None:
          raise ValueError(
              "Dense: input_rank and map_rank cannot be specified at the same time."
          )
  
      # If input_rank not given then pass a single _INFERRED;
      # map_rank if given will determine the input_rank.
      # The dimension inference may still create multiple axes.
      input_shape = _INFERRED
  
      # parameters bound to this Function
      #    init_weights = _initializer_for(init, Record(output_rank=output_rank))
      init_weights = init
      W1 = Parameter(
          input_shape + output_shape1,
          init=init_weights["W1"],
          name="W1",
      )
      W2 = Parameter(
          output_shape1 + output_shape2,
          init=init_weights["W2"],
          name="W2",
      )
      b = (
          Parameter(output_shape2, init=init_bias, name="b")
          if bias
          else None
      )
  
      # expression of this function
      @BlockFunction("DenseFactored", name)
      def dense(x):
          r = times(x, W1)
          r = times(r, W2)
          if b:
              r = r + b
          if activation is not None:
              r = activation(r)
          return r
  
      return dense
  
file_path: CNTK/bindings/python/cntk/contrib/netopt/factorization.py
imports: import cntk
  from cntk.ops.functions import BlockFunction
  from cntk.variables import Parameter
  from cntk.ops import times
  from cntk.internal import _as_tuple
  from cntk.layers.blocks import _initializer_for, _INFERRED, identity
  from cntk.layers.blocks import UntestedBranchError
  from cntk.default_options import is_default_override
  from cntk.default_options import get_default_override, default_override_or
label_desc: Use image node_id 3 for calling a global function with example usage: dense_factored(shapes, activation, init, input_rank, map_rank, bias, init_bias, name) and returns: dense, r