Пример #1
0
def aux_logits():
    return mo.siso_sequential([
        relu(),
        avg_pool2d(D([5]), D([3]), D(['VALID'])),
        conv2d(D([128]), D([1])),
        batch_normalization(),
        relu(),
        global_convolution(D([768])),
        batch_normalization(),
        relu(),
        flatten(),
        fc_layer(D([10]))
    ])
Пример #2
0
def intermediate_node_fn(num_inputs, filters):
    return mo.siso_sequential([
        add(num_inputs),
        conv2d(D([filters]), D([3])),
        batch_normalization(),
        relu()
    ])
Пример #3
0
 def generate(filters):
     return cell(
         lambda channels: mo.siso_sequential(
             [conv2d(D([channels]), D([1])),
              batch_normalization(),
              relu()]),
         lambda num_inputs, node_id, channels: intermediate_node_fn(
             num_inputs, node_id, channels, cell_ops), concat,
         h_connections, 5, filters)
Пример #4
0
def conv_op(filters, filter_size, stride, dilation_rate, spatial_separable):
    if spatial_separable:
        return mo.siso_sequential([
            conv2d(D([filters]), D([[1, filter_size]]), D([[1, stride]])),
            batch_normalization(),
            relu(),
            conv2d(D([filters]), D([[filter_size, 1]]), D([[stride, 1]])),
        ])
    else:
        return conv2d(D([filters]), D([filter_size]), D([stride]),
                      D([dilation_rate]))
Пример #5
0
def intermediate_node_fn(num_inputs, node_id, filters, cell_ops):
    return mo.siso_sequential([
        add(num_inputs),
        mo.siso_or(
            {
                'conv1': lambda: conv2d(D([filters]), D([1])),
                'conv3': lambda: conv2d(D([filters]), D([3])),
                'max3': lambda: max_pool2d(D([3]))
            }, cell_ops[node_id]),
        batch_normalization(),
        relu()
    ])
Пример #6
0
def generate_stage(stage_num, num_nodes, filters, filter_size):
    h_connections = [
        Bool(name='%d_in_%d_%d' % (stage_num, in_id, out_id))
        for (in_id,
             out_id) in itertools.combinations(range(1, num_nodes + 1), 2)
    ]

    return genetic_stage(
        lambda: mo.siso_sequential([
            conv2d(D([filters]), D([filter_size])),
            batch_normalization(),
            relu()
        ]), lambda num_inputs: intermediate_node_fn(num_inputs, filters), lambda
        num_inputs: intermediate_node_fn(num_inputs, filters), h_connections,
        num_nodes)
Пример #7
0
def wrap_relu_batch_norm(op):
    return mo.siso_sequential([relu(), op, batch_normalization()])
Пример #8
0
def stem(filters):
    return mo.siso_sequential(
        [conv2d(D([filters]), D([3])),
         batch_normalization()])
Пример #9
0
def stem():
    return mo.siso_sequential([
        conv2d(D([128]), D([3])),
        batch_normalization(),
        relu(),
    ])