code: def get_cgc_model(schema, args, prediction_tasks):
      expert_block_mlp = mm.MLPBlock(
          args.expert_mlp_layers,
          activation=args.activation,
          kernel_initializer=args.mlp_init,
          dropout=args.dropout,
          kernel_regularizer=regularizers.l2(args.l2_reg),
          bias_regularizer=regularizers.l2(args.l2_reg),
      )
  
      input_block = mm.InputBlockV2(
          schema,
          categorical=mm.Embeddings(
              schema.select_by_tag(Tags.CATEGORICAL),
              embeddings_regularizer=regularizers.l2(
                  args.embeddings_l2_reg
              ),
              infer_dim_fn=partial(
                  infer_embedding_dim,
                  multiplier=args.embedding_sizes_multiplier,
              ),
          ),
          aggregation="concat",
      )
  
      cgc_kwargs = {}
      if args.gate_dim > 0:
          cgc_kwargs["gate_block"] = mm.MLPBlock([args.gate_dim])
      cgc = mm.CGCBlock(
          prediction_tasks,
          expert_block=expert_block_mlp,
          num_task_experts=args.cgc_num_task_experts,
          num_shared_experts=args.cgc_num_shared_experts,
          gate_softmax_temperature=args.mtl_gates_softmax_temperature,
          enable_gate_weights_metrics=True,
          **cgc_kwargs,
      )
  
      return Model(input_block, cgc, prediction_tasks)
  
file_path: Merlin/examples/quick_start/scripts/ranking/ranking_models.py
imports: from functools import partial
  import merlin.models.tf
  from merlin.models.tf import Model
  from merlin.models.utils.schema_utils import infer_embedding_dim
  from merlin.schema.tags import Tags
  from tensorflow.keras import regularizers
label_desc: Use image node_id 8 for calling a global function with example usage: get_cgc_model(schema, args, prediction_tasks) and returns: Model