

def test_multi_optimizer(backend_default):
    opt_gdm = GradientDescentMomentum(learning_rate=0.001, momentum_coef=0.9, wdecay=0.005)
    opt_ada = Adadelta()
    opt_adam = Adam()
    opt_rms = RMSProp()
    opt_rms_1 = RMSProp(gradient_clip_value=5)
    init_one = Gaussian(scale=0.01)
    l1 = Conv((11, 11, 64), strides=4, padding=3, init=init_one, bias=Constant(0), activation=Rectlin())
    l2 = Affine(nout=4096, init=init_one, bias=Constant(1), activation=Rectlin())
    l3 = LSTM(output_size=1000, init=init_one, activation=Logistic(), gate_activation=Tanh())
    l4 = GRU(output_size=100, init=init_one, activation=Logistic(), gate_activation=Tanh())
    layers = [l1, l2, l3, l4]
    layer_list = []
    for layer in layers:
        if isinstance(layer, list):
            l2.extend(layer)
        else:
            layer_list.append(layer)
    opt = MultiOptimizer({
        'default': opt_gdm,
        'Bias': opt_ada,
        'Convolution': opt_adam,
        'Linear': opt_rms,
        'LSTM': opt_rms_1,
        'GRU': opt_rms_1,
    })
    map_list = opt.map_optimizers(layer_list)
    assert (map_list[opt_adam][0].__class__.__name__ == 'Convolution')
    assert (map_list[opt_ada][0].__class__.__name__ == 'Bias')
    assert (map_list[opt_rms][0].__class__.__name__ == 'Linear')
    assert (map_list[opt_gdm][0].__class__.__name__ == 'Activation')
    assert (map_list[opt_rms_1][0].__class__.__name__ == 'LSTM')
    assert (map_list[opt_rms_1][1].__class__.__name__ == 'GRU')

dataset/ETHPy150Open NervanaSystems/neon/tests/test_optimizer.py test_multi_optimizer/VarMisuse@211/281 `layer_list`->`l2`