Пример #1
0
def create_components(config, env):
    action_dim = env.action_dim
    encoder_config = config['encoder']
    q_config = config['q']

    if 'cnn_name' in encoder_config:
        encoder_config['time_distributed'] = True
    model = dict(
        encoder=Encoder(encoder_config, name='encoder'),
        q=Q(q_config, action_dim, name='q'),
        target_encoder=Encoder(encoder_config, name='target_encoder'),
        target_q=Q(q_config, action_dim, name='target_q'),
    )
    if config.get('rnn'):
        rnn_config = config['rnn']
        model.update({
            'rnn': LSTM(rnn_config, name='rnn'),
            'target_rnn': LSTM(rnn_config, name='target_rnn')
        })
    if config.get('actor'):
        actor_config = config['actor']
        model.update({
            'actor':
            Actor(actor_config, action_dim, name='actor'),
            'target_actor':
            Actor(actor_config, action_dim, name='target_actor')
        })

    return model
Пример #2
0
Файл: nn.py Проект: xlnwel/d2rl
def create_components(config, env, **kwargs):
    action_dim = env.action_dim
    return dict(
        encoder=Encoder(config['encoder'], name='encoder'),
        q=Q(config['q'], action_dim, name='q'),
        target_encoder=Encoder(config['encoder'], name='target_encoder'),
        target_q=Q(config['q'], action_dim, name='target_q'),
    )
Пример #3
0
Файл: nn.py Проект: xlnwel/d2rl
def create_components(config, env, n_agents, **kwargs):
    return dict(
        q_encoder=Encoder(config['q_encoder'], name='encoder'),
        q_rnn=rnn(config['q_rnn'], name='q_rnn'),
        q=Q(config['q'], env.action_dim, name='q'),
        qmixer=QMixer(config['q_mixer'], n_agents, name='qmix'),
        target_q_encoder=Encoder(config['q_encoder'], name='target_encoder'),
        target_q_rnn=rnn(config['q_rnn'], name='target_q_rnn'),
        target_q=Q(config['q'], env.action_dim, name='target_q'),
        target_qmixer=QMixer(config['q_mixer'], n_agents, name='target_qmix'),
    )
Пример #4
0
def create_components(config, env, **kwargs):
    action_dim = env.action_dim
    return dict(
        encoder=Encoder(config['encoder'], name='cnn'),
        fpn=FractionProposalNetwork(config['fpn'], name='fpn'),
        qe=QuantileEmbed(config['qe'], name='qe'),
        q=Value(config['q'], action_dim, name='iqn'),
        target_encoder=Encoder(config['encoder'], name='target_cnn'),
        target_fpn=FractionProposalNetwork(config['fpn'], name='fpn'),
        target_qe=QuantileEmbed(config['qe'], name='qe'),
        target_q=Value(config['q'], action_dim, name='target_iqn'),
    )
Пример #5
0
Файл: nn.py Проект: xlnwel/d2rl
def create_components(config, env, **kwargs):
    assert env.is_action_discrete
    action_dim = env.action_dim
    encoder_config = config['encoder']
    quantile_config = config['quantile']
    q_config = config['q']
    
    return dict(
        encoder=Encoder(encoder_config, name='encoder'),
        quantile=Quantile(quantile_config, name='phi'),
        q=Value(q_config, action_dim, name='q'),
        target_encoder=Encoder(encoder_config, name='target_encoder'),
        target_quantile=Quantile(quantile_config, name='target_phi'),
        target_q=Value(q_config, action_dim, name='target_q'),
    )
Пример #6
0
Файл: nn.py Проект: xlnwel/d2rl
def create_components(config, env):
    action_dim = env.action_dim
    is_action_discrete = env.is_action_discrete

    return dict(
        encoder=Encoder(config['encoder']), 
        actor=Actor(config['actor'], action_dim, is_action_discrete),
        value=Value(config['value'])
    )
Пример #7
0
Файл: nn.py Проект: xlnwel/d2rl
def create_components(config, env):
    action_dim = env.action_dim
    encoder_config = config['encoder']
    quantile_config = config['quantile']
    q_config = config['q']

    encoder_config['time_distributed'] = True
    model = dict(
        encoder=Encoder(encoder_config, name='encoder'),
        quantile=Quantile(quantile_config, name='phi'),
        q=Value(q_config, action_dim, name='q'),
        target_encoder=Encoder(encoder_config, name='target_encoder'),
        target_quantile=Quantile(quantile_config, name='target_phi'),
        target_q=Value(q_config, action_dim, name='target_q'),
    )
    if config.get('rnn'):
        rnn_config = config['rnn']
        model.update({
            'rnn': LSTM(rnn_config, name='rnn'),
            'target_rnn': LSTM(rnn_config, name='target_rnn')
        })

    return model