Exemplo n.º 1
0
def demo():
    """
    Build a network and show its backprop graph.
    """
    from plugins.backprop_visualizer import make_dot_backprop
    from plugins.genome_visualizer import make_dot_genome
    genome = [
        [[1], [0, 0], [1, 0, 0], [1]],
        [  # Phase will be ignored, there are no active connections (residual is not counted as active).
            [0], [0, 0], [0, 0, 0], [1]
        ],
        [[1], [0, 0], [0, 0, 0], [0, 0, 0, 0], [1]]
    ]

    channels = [(3, 8), (8, 8), (8, 8)]
    data = torch.randn(16, 3, 32, 32)

    chopped = [gene[:-1] for gene in genome]
    make_dot_genome(chopped).view()

    model = ResidualGenomeDecoder(genome, channels, repeats=[1, 2,
                                                             3]).get_model()
    out = model(torch.autograd.Variable(data))

    make_dot_backprop(out).view()
Exemplo n.º 2
0
def demo():
    from plugins.backprop_visualizer import make_dot_backprop
    genome = [[[1], [0, 0], [1, 1, 1], [1], [2]],
              [[0], [0, 0], [0, 0, 0], [1], [2]],
              [[1], [0, 0], [1, 0, 1], [1, 1, 0, 1], [0], [2]]]

    channels = [(3, 8), (8, 16), (16, 32)]
    data = torch.randn(16, 3, 32, 32)

    model = VariableGenomeDecoder(genome, channels).get_model()
    out = model(torch.autograd.Variable(data))

    make_dot_backprop(out).view()
Exemplo n.º 3
0
def demo():
    from plugins.backprop_visualizer import make_dot_backprop
    genome = [
        [[1], [0, 0], [1, 1, 1], [1]],
        [  # Phase will be ignored, there are no active connections (residual is not counted as active).
            [0], [0, 0], [0, 0, 0], [1]
        ],
        [[1], [0, 0], [1, 1, 1], [0, 0, 1, 0], [1]]
    ]

    channels = [(3, 8), (8, 8), (8, 8)]
    data = torch.randn(16, 3, 32, 32)

    model = ResidualGenomeDecoder(genome, channels).get_model()
    out = model(torch.autograd.Variable(data))

    make_dot_backprop(out).view()
Exemplo n.º 4
0
def demo():
    """
    Build a network and show its backprop graph.
    """
    from plugins.backprop_visualizer import make_dot_backprop
    from plugins.genome_visualizer import make_dot_genome
    genome = [[[1], [0, 1], [0, 1, 0], [1, 1, 0, 1], [1, 0, 1, 0, 0], [0]],
              [[0], [0, 1], [0, 0, 1], [0, 1, 0, 1], [1, 0, 1, 1, 1], [0]],
              [[1], [0, 0], [0, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1, 1], [1]]]

    channels = [(3, 32), (32, 32), (32, 32)]
    data = torch.randn(16, 3, 32, 32)

    make_dot_genome(genome).view()

    model = DenseGenomeDecoder(genome, channels).get_model()
    out = model(torch.autograd.Variable(data))

    make_dot_backprop(out).view()