'Initializes the MasterBuilder from specifications.
During construction, all components are initialized along with their
parameter tf.Variables.
Args:
master_spec: dragnn.MasterSpec proto.
hyperparam_config: dragnn.GridPoint proto specifying hyperparameters.
Defaults to empty specification.
pool_scope: string identifier for the compute session pool to use.
Raises:
ValueError: if a component is not found in the registry.'

def __init__(self, master_spec, hyperparam_config=None, pool_scope='shared'):

    self.spec = master_spec
    self.hyperparams = (spec_pb2.GridPoint() if (hyperparam_config is None) else hyperparam_config)
    self.pool_scope = pool_scope
    tf.set_random_seed(hyperparam_config.seed)
    self.components = []
    self.lookup_component = {}
    for component_spec in master_spec.component:
        component_type = component_spec.component_builder.registered_name
        comp = component.ComponentBuilderBase.Create(component_type, self, component_spec)
        self.lookup_component[comp.name] = comp
        self.components.append(comp)
    self.master_vars = {}
    with tf.variable_scope('master', reuse=False):
        self.master_vars['step'] = tf.get_variable('step', [], initializer=tf.zeros_initializer(), dtype=tf.int32)
        self.master_vars['learning_rate'] = _create_learning_rate(self.hyperparams, self.master_vars['step'])
    self.optimizer = _create_optimizer(self.hyperparams, self.master_vars['learning_rate'], self.master_vars['step'])
