'Initializes parameters for embedding matrices.
The subclass may provide optional lists of initial layers and context layers
to allow this base class constructor to use accessors like get_layer_size(),
which is required for networks that may be used self-recurrently.
Args:
component: parent ComponentBuilderBase object.
init_layers: optional initial layers.
init_context_layers: optional initial context layers.'

def __init__(self, component, init_layers=None, init_context_layers=None):

    self._component = component
    self._params = []
    self._layers = (init_layers if init_layers else [])
    self._regularized_weights = []
    self._context_layers = (init_context_layers if init_context_layers else [])
    self._fixed_feature_dims = {}
    self._linked_feature_dims = {}
    for (channel_id, spec) in enumerate(component.spec.fixed_feature):
        check.NotIn(spec.name, self._fixed_feature_dims, 'Duplicate    fixed    feature')
        check.Gt(spec.size, 0, 'Invalid    fixed    feature    size')
        if (spec.embedding_dim > 0):
            fixed_dim = spec.embedding_dim
            self._params.append(add_embeddings(channel_id, spec))
        else:
            fixed_dim = 1
        self._fixed_feature_dims[spec.name] = (spec.size * fixed_dim)
    for (channel_id, spec) in enumerate(component.spec.linked_feature):
        check.NotIn(spec.name, self._linked_feature_dims, 'Duplicate    linked    feature')
        check.Gt(spec.size, 0, 'Invalid    linked    feature    size')
        if (spec.source_component == component.name):
            source_array_dim = self.get_layer_size(spec.source_layer)
        else:
            source = component.master.lookup_component[spec.source_component]
            source_array_dim = source.network.get_layer_size(spec.source_layer)
        if (spec.embedding_dim != (-1)):
            check.Gt(source_array_dim, 0, 'Cannot    embed    linked    feature    with    dynamic    dimension')
            self._params.append(tf.get_variable(linked_embeddings_name(channel_id), [(source_array_dim + 1), spec.embedding_dim], initializer=tf.random_normal_initializer(stddev=(1 / (spec.embedding_dim ** 0.5)))))
            self._linked_feature_dims[spec.name] = (spec.size * spec.embedding_dim)
        else:
            self._linked_feature_dims[spec.name] = (spec.size * source_array_dim)
    input_dims = (self._fixed_feature_dims.values() + self._linked_feature_dims.values())
    if any(((x < 0) for x in input_dims)):
        self._concatenated_input_dim = (-1)
    else:
        self._concatenated_input_dim = sum(input_dims)
    tf.logging.info('component    %s    concat_input_dim    %s', component.name, self._concatenated_input_dim)
    if self._component.spec.attention_component:
        attention_source_component = self._component.master.lookup_component[self._component.spec.attention_component]
        attention_hidden_layer_sizes = map(int, attention_source_component.spec.network_unit.parameters['hidden_layer_sizes'].split(','))
        attention_hidden_layer_size = attention_hidden_layer_sizes[(-1)]
        hidden_layer_sizes = map(int, component.spec.network_unit.parameters['hidden_layer_sizes'].split(','))
        hidden_layer_size = hidden_layer_sizes[(-1)]
        self._params.append(tf.get_variable('attention_weights_pm_0', [attention_hidden_layer_size, hidden_layer_size], initializer=tf.random_normal_initializer(stddev=0.0001)))
        self._params.append(tf.get_variable('attention_weights_hm_0', [hidden_layer_size, hidden_layer_size], initializer=tf.random_normal_initializer(stddev=0.0001)))
        self._params.append(tf.get_variable('attention_bias_0', [1, hidden_layer_size], initializer=tf.zeros_initializer()))
        self._params.append(tf.get_variable('attention_bias_1', [1, hidden_layer_size], initializer=tf.zeros_initializer()))
        self._params.append(tf.get_variable('attention_weights_pu', [attention_hidden_layer_size, component.num_actions], initializer=tf.random_normal_initializer(stddev=0.0001)))
