Ejemplo n.º 1
0
def test_copy_data_generation():
    input_sequence, output_sequence = dataset.generate_copy_data(8, 10)
    print input_sequence
    print output_sequence
    input_sequence, output_sequence = dataset.generate_copy_data(8, 20)
    print input_sequence
    print output_sequence
    input_sequence, output_sequence = dataset.generate_copy_data(8, 30)
    print input_sequence
    print output_sequence
    input_sequence, output_sequence = dataset.generate_copy_data(8, 50)
    print input_sequence
    print output_sequence
    input_sequence, output_sequence = dataset.generate_copy_data(8, 120)
    print input_sequence
    print output_sequence
Ejemplo n.º 2
0
def test_show_memory_of_copy_task():
    input_sequence, output_sequence = dataset.generate_copy_data(8, 20)
    input_sequence = input_sequence.transpose()
    output_sequence = output_sequence.transpose()
    adds = dataset.generate_random_binomial(16, 40)
    reads = dataset.generate_random_binomial(16, 40)
    write_weightings, read_weightings = dataset.generate_weightings(36, 40)
    image_file = "image/figure_6.png"
    visualization.show_memory_of_copy_task(input_sequence, output_sequence,
                                           adds, reads, write_weightings,
                                           read_weightings, image_file)
Ejemplo n.º 3
0
def test_show_copy_data():
    input_sequence_10, output_sequence_10 = dataset.generate_copy_data(8, 10)
    input_sequence_20, output_sequence_20 = dataset.generate_copy_data(8, 20)
    input_sequence_30, output_sequence_30 = dataset.generate_copy_data(8, 30)
    input_sequence_50, output_sequence_50 = dataset.generate_copy_data(8, 50)
    input_sequence_120, output_sequence_120 = dataset.generate_copy_data(
        8, 120)

    input_sequence_10 = input_sequence_10.transpose()
    output_sequence_10 = output_sequence_10.transpose()

    input_sequence_20 = input_sequence_20.transpose(
    )[:, 0:input_sequence_20.size / 2]
    output_sequence_20 = output_sequence_20.transpose(
    )[:, 0:output_sequence_20.size / 2]

    input_sequence_30 = input_sequence_30.transpose(
    )[:, 0:input_sequence_30.size / 2]
    output_sequence_30 = output_sequence_30.transpose(
    )[:, 0:output_sequence_30.size / 2]

    input_sequence_50 = input_sequence_50.transpose(
    )[:, 0:input_sequence_50.size / 2]
    output_sequence_50 = output_sequence_50.transpose(
    )[:, 0:output_sequence_50.size / 2]

    input_sequence_120 = input_sequence_120.transpose(
    )[:, 0:input_sequence_120.size / 2]
    output_sequence_120 = output_sequence_120.transpose(
    )[:, 0:output_sequence_120.size / 2]

    print "10"
    print(input_sequence_10.shape[1] - 1) / 2
    print input_sequence_10
    print "20"
    print(input_sequence_20.shape[1] - 1) / 2
    print input_sequence_20
    print "30"
    print(input_sequence_30.shape[1] - 1) / 2
    print input_sequence_30
    print "50"
    print(input_sequence_50.shape[1] - 1) / 2
    print input_sequence_50
    print "120"
    print(input_sequence_120.shape[1] - 1) / 2
    print input_sequence_120

    image_file = 'image/figure_4.png'

    visualization.show_multi_copy_data(
        input_sequence_10[:, 0:(input_sequence_10.shape[1] - 1) / 2],
        output_sequence_10[:, (output_sequence_10.shape[1] + 1) /
                           2:output_sequence_10.shape[1]],
        input_sequence_20[:, 0:(input_sequence_20.shape[1] - 1) / 2],
        output_sequence_20[:, (output_sequence_20.shape[1] + 1) /
                           2:output_sequence_20.shape[1]],
        input_sequence_30[:, 0:(input_sequence_30.shape[1] - 1) / 2],
        output_sequence_30[:, (output_sequence_30.shape[1] + 1) /
                           2:output_sequence_30.shape[1]],
        input_sequence_50[:, 0:(input_sequence_50.shape[1] - 1) / 2],
        output_sequence_50[:, (output_sequence_50.shape[1] + 1) /
                           2:output_sequence_50.shape[1]],
        input_sequence_120[:, 0:(input_sequence_120.shape[1] - 1) / 2],
        output_sequence_120[:, (output_sequence_120.shape[1] + 1) /
                            2:output_sequence_120.shape[1]], image_file)