class_docstr: A simple object to capture a task head (tower).
code: def get_task(
      phoenix_spec,
      tower_name,
      architecture,
      is_training,
      logits_dimesnion,
      is_frozen,
      hparams,
      model_directory,
      generator_name=None,
      previous_tower_name=None,
      previous_model_dir=None,
  ):
      # Building from checkpoint - no need to boostrap models
      if (
          tf.train.latest_checkpoint(model_directory)
          or generator_name == base_tower_generator.SEARCH_GENERATOR
          or architecture.size == 0
      ):
          task_ = Task(
              phoenix_spec=phoenix_spec,
              tower_name=tower_name,
              architecture=architecture,
              is_training=is_training,
              logits_dimension=logits_dimesnion,
              is_frozen=is_frozen,
              hparams=hparams,
              model_directory=model_directory,
              generator_name=generator_name,
          )
          if (
              architecture.size == 0
              and not tf.train.latest_checkpoint(model_directory)
              and generator_name
              != base_tower_generator.SEARCH_GENERATOR
          ):
              task_.add_initialization(
                  prev_model_dir=previous_model_dir,
                  prev_tower_name=previous_tower_name,
              )
          return task_
      else:
          return Task.load(
              phoenix_spec=phoenix_spec,
              original_tower_name=previous_tower_name,
              new_tower_name=tower_name,
              model_directory=previous_model_dir,
              new_model_directory=model_directory,
              is_training=is_training,
              logits_dimension=logits_dimesnion,
              force_freeze=True,
              allow_auxiliary_head=False,
              skip_initialization=False,
          )
  
imports: import collections
  import functools
  import inspect
  from absl import logging
  from model_search import block_builder
  from model_search import ensembler
  from model_search.architecture import architecture_utils
  from model_search.architecture import tower
  from model_search.ensembler import EnsembleLogits
  from model_search.generators import base_tower_generator
  from model_search.generators import trial_utils
  from model_search.meta import distillation
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the Task obj's underlying member method code with example usage: obj.get_task(phoenix_spec, tower_name, architecture, is_training, logits_dimesnion, is_frozen, hparams, model_directory, generator_name, previous_tower_name, previous_model_dir) and returns: task_, Task