---
dataset:
    background_class: {use: false}
    preprocess:
        shape:
            height: 32
            width: 32
            channels: 3
        validate:
            - {type: crop_or_pad}
            # - {type: central_crop, fraction: 0.875}
        final_cpu:
            - {type: standardize_image}
model:
    name: cifarnet
    description: |
        A variant of cifarnet that performs online gating
    layers:
        _conv: &conv
            type: convolution
            padding: same
            weights_initializer: &trunc_norm_init
                type: tensorflow.truncated_normal_initializer
                stddev: 0.05
        _gate: &gate
            type: local_gating
            policy:
                type: threshold_based
                alpha: 0.35
            # policy:
            #     type: tensorflow.contrib.layers.l1_regularizer
            #     scale: 0.001
        _pool: &pool
            type: max_pool
            kernel_size: 3
            stride: 2
            padding: valid
        _fc: &fc
            type: fully_connected
            weights_initializer:
                <<: *trunc_norm_init
                stddev: 0.04
            biases_initializer: &bias_init
                type: tensorflow.constant_initializer
                value: 0.1
            weights_regularizer:
                type: tensorflow.contrib.layers.l2_regularizer
                scale: 0.004
        conv1: {<<: *conv, kernel_size: 5, num_outputs: 64}
        pool1: *pool
        gate1: *gate
        norm1: &norm
            type: local_response_normalization
            depth_radius: 4
            alpha: !arith 0.001 / 9.0
            beta: 0.75
            bias: 1.0
        conv2: {
            <<: *conv, kernel_size: 5, num_outputs: 64,
            biases_initializer: *bias_init}
        norm2: *norm
        gate2: *gate
        pool2: *pool
        flatten2: {type: flatten}
        fc3: {<<: *fc, num_outputs: 384}
        dropout3: {type: dropout, keep_prob: 0.5}
        fc4: {<<: *fc, num_outputs: 192}
        logits:
            <<: *fc
            num_outputs: num_classes
            biases_initializer: {type: tensorflow.zeros_initializer}
            weights_initializer:
                {<<: *trunc_norm_init, stddev: !arith 1.0 / 192.0}
            weights_regularizer: null
            activation_fn: null
    graph:
        from: input
        with: [
            conv1, pool1, norm1, gate1,
            conv2, norm2, pool2, gate2, flatten2,
            fc3, dropout3, fc4, logits]
        to: output
