Beispiel #1
0
def model(th):
  assert isinstance(th, m.Config)
  model = m.get_container(th, flatten=True)
  model.add(Dense(th.layer_width, th.spatial_activation))
  model.add(Highway(
    th.layer_width, th.num_layers, th.spatial_activation,
    t_bias_initializer=th.bias_initializer))
  # model.register_extractor(LinearHighway.extractor)
  return m.finalize(th, model)
Beispiel #2
0
def model(th):
    assert isinstance(th, m.Config)
    model = m.get_container(th, flatten=True)
    # Add hidden layers
    for i, n in enumerate([int(s) for s in th.archi_string.split('-')]):
        model.add(m.Dense(n))
        if i > 0 and th.use_batchnorm: model.add(m.BatchNormalization())
        model.add(m.Activation(th.spatial_activation))
    # Finalize model
    return m.finalize(th, model)
Beispiel #3
0
def model(th):
  assert isinstance(th, m.Config)
  model = m.get_container(th, flatten=True)
  model.add(Dense(th.layer_width, th.spatial_activation))
  model.add(SLHighway(
    config_string=th.group_string,
    num_layers=th.num_layers,
    head_size=th.head_size,
    activation=th.spatial_activation,
    gutter=th.gutter,
    gutter_bias=th.gutter_bias,
  ))
  model.register_extractor(SLHighway.extractor)
  return m.finalize(th, model)