예제 #1
0
def test_base_model_inheritance_ver1(clean_config):
    x = tf.ones([32, 64, 64, 3], dtype=tf.float32)
    m1 = Conv2D('conv', 32, 3)
    m2 = Dense('dense', 160)
    m3 = Stack([m1, m2])
    res1 = m3(x)
    assert shape(res1) == [32, 64, 64, 160]
예제 #2
0
    def _short_cut(self, name):
        conv2d_ins = Conv2D(name=name,
                            filters=self.config[self.KEYS.CONFIG.FILTERS],
                            kernel_size=self.config[self.KEYS.CONFIG.KERNEL_SIZE])

        return Stack(name='short_cut',
                     models=[conv2d_ins,
                             self._inference_blk(self.config[self.KEYS.CONFIG.NUM_INFER_BLK],
                                                 ResidualBlock(name='res_blk',
                                                               filters=self.config[self.KEYS.CONFIG.FILTERS]))])
예제 #3
0
파일: model.py 프로젝트: alex10151/dxlearn
 def kernel(self, inputs):
     x = inputs[self.KEYS.TENSOR.HITS]
     x = flatten(x)
     m = identity
     models = []
     for i in range(3):
         models += [Dense(self.config(self.KEYS.CONFIG.NB_UNITS)
                          [i], info='dense_{}'.format(i)),
                    ReLU,
                    DropOut()]
     # models.append(DropOut())
     models.append(
         Dense(self.config(self.KEYS.CONFIG.MAX_NB_HITS), info='dense_end'))
     seq = self.graphs.get('seq', Stack(info='stack', models=models))
     return seq(x)
예제 #4
0
def inference_blk(num_layer, layer):
    l = []
    for _ in range(num_layer):
        l.append(layer)

    return Stack(name='stack', models=l)
예제 #5
0
    def _inference_blk(self, num_inference_blocks, layer):
        l = []
        for _ in range(num_inference_blocks):
            l.append(layer)

        return Stack(name='inference_blk', models=l)