Esempio n. 1
0
def stack(net, level):
    
    n = pu.copy_net_params(net)
    
    enc_prev = None
    dec_prev = None
    enc = None
    dec = None
    for l in n.layer:
        if l.name.lower().endswith('encode%03dneuron' % (level-1)):
            enc = pu.copy_msg(l, LayerParameter)
            
            for b in list(enc.bottom):
                l.bottom.remove(b)
            for t in list(l.top):
                l.bottom.append(unicode(t)) # preserve order of layer bottoms, label as bottom has to come last
            
        elif l.name.lower().endswith('decode%03dneuron' % (level-1)):
            dec_prev = l
            dec = pu.copy_msg(l, LayerParameter)
            
    enc.name = 'encode%03dneuron' % level
    dec.name = 'encode%03dneuron' % level
    
    
    return n
Esempio n. 2
0
 def test_copy_msg(self):
     
     x = NetParameter()
     assert_is_not_none(x)
     y = pu.copy_msg(x, NetParameter)
     assert_is_not(x, y)
     assert_is_not_none(y)
Esempio n. 3
0
    def test_copy_msg(self):

        x = NetParameter()
        assert_is_not_none(x)
        y = pu.copy_msg(x, NetParameter)
        assert_is_not(x, y)
        assert_is_not_none(y)