Exemplo n.º 1
0
    def setUp(self):
        super(self.__class__, self).setUp()
        self.input_data = numpy.array(
            [[[1.], [2.], [3.], [4.]], [[5.], [6.], [7.], [8.]],
             [[5.], [6.], [7.], [8.]], [[9.], [10.], [11.], [12.]]],
            dtype=numpy.float)
        self.sequence = SequenceInputMock(self.bookkeeper, self.input_data,
                                          [[0.], [0.], [0.], [1.]], 13)

        self.input, self.output = recurrent_networks.create_sequence_pretty_tensor(
            self.sequence)
Exemplo n.º 2
0
  def setUp(self):
    super(self.__class__, self).setUp()
    self.input_data = numpy.array(
        [
            [[1.], [2.], [3.], [4.]], [[5.], [6.], [7.], [8.]],
            [[5.], [6.], [7.], [8.]], [[9.], [10.], [11.], [12.]]
        ],
        dtype=numpy.float)
    self.sequence = SequenceInputMock(self.bookkeeper, self.input_data,
                                      [[0.], [0.], [0.], [1.]], 13)

    self.input, self.output = recurrent_networks.create_sequence_pretty_tensor(
        self.sequence)
Exemplo n.º 3
0
    def testSquashAndCleaveLength1(self):
        input_data = numpy.array([[[1.], [2.], [3.], [4.]]], dtype=numpy.float)
        sequence = SequenceInputMock(self.bookkeeper, input_data, [[0.]], 13)

        inp, _ = recurrent_networks.create_sequence_pretty_tensor(sequence)
        squashed = inp.squash_sequence()
        result = self.RunTensor(squashed)

        testing.assert_allclose(input_data.reshape(4, 1),
                                result,
                                rtol=TOLERANCE)

        result = self.RunTensor(squashed.cleave_sequence())

        testing.assert_allclose(input_data[0], result[0], rtol=TOLERANCE)
        self.assertEquals(1, len(result))
Exemplo n.º 4
0
  def testSquashAndCleaveLength1(self):
    input_data = numpy.array(
        [[[1.], [2.], [3.], [4.]]], dtype=numpy.float)
    sequence = SequenceInputMock(self.bookkeeper, input_data, [[0.]], 13)

    inp, _ = recurrent_networks.create_sequence_pretty_tensor(sequence)
    squashed = inp.squash_sequence()
    result = self.RunTensor(squashed)

    testing.assert_allclose(
        input_data.reshape(4, 1), result,
        rtol=TOLERANCE)

    result = self.RunTensor(squashed.cleave_sequence())

    testing.assert_allclose(input_data[0], result[0], rtol=TOLERANCE)
    self.assertEquals(1, len(result))