示例#1
0
 def _short_cut(self, name):
     conv2d_ins = Conv2D(info="conv2d",
                         filters=self.config(self.KEYS.CONFIG.FILTERS),
                         kernel_size=(1, 1),
                         strides=(1, 1),
                         padding='same',
                         activation='basic')
     return Stack(info=self.info.child_scope(name),
                  models=conv2d_ins,
                  nb_layers=2)
示例#2
0
def test_stack_basic(clean_config):
    models = [
        Conv2D('conv1', 64, 3),
        Conv2D('conv2', 128, 3),
        Conv2D('conv3', 256, 3)
    ]
    x = tf.ones([32, 64, 64, 3], dtype=tf.float32)
    st = Stack(models)
    res = st(x)
    assert shape(res) == [32, 64, 64, 256]
示例#3
0
def test_stack_parameters(clean_config):
    models = [
        Conv2D('conv1', 64, 3),
        Conv2D('conv2', 128, 3),
        Conv2D('conv3', 256, 3)
    ]
    x = tf.ones([32, 64, 64, 3], dtype=tf.float32)
    st = Stack(models)
    res = st(x)
    assert st.parameters[0].get_shape() == (3, 3, 3, 64)
示例#4
0
    def test_Stack(self):
        x = self.get_input()
        nb_layers = 2
        y_ = x

        stack_ins = Stack('Stack_test', tf.constant(x), self.make_model(),
                          nb_layers)
        y = stack_ins()
        with self.variables_initialized_test_session() as sess:
            y = sess.run(y)
            self.assertAllEqual(y, y_)
示例#5
0
文件: base.py 项目: tech-pi/dxlearn
 def fmap(self, m):
     from dxl.learn.model.stack import Stack
     return Stack([m, self])