Esempio n. 1
0
def ctc_data():
    """ Returns a provider that can be used with `ctc_model()`.
	"""
    number_of_samples = 11
    vocab_size = 4  # Same as above
    output_timesteps = 10
    maximum_transcription_length = 4  # Must be <= output_timesteps
    return BatchProvider(
        sources={
            'TEST_input':
            VanillaSource(
                numpy.random.uniform(low=-1,
                                     high=1,
                                     size=(number_of_samples, output_timesteps,
                                           2))),
            'TEST_transcription':
            VanillaSource(
                numpy.random.random_integers(0,
                                             vocab_size - 1,
                                             size=(number_of_samples,
                                                   maximum_transcription_length
                                                   ))),
            'TEST_input_length':
            VanillaSource(
                numpy.ones(shape=(number_of_samples, 1)) * output_timesteps),
            'TEST_transcription_length':
            VanillaSource(
                numpy.random.random_integers(1,
                                             maximum_transcription_length,
                                             size=(number_of_samples, 1)))
        })
Esempio n. 2
0
def simple_data():
    """ Returns a small provider that can be used to train the `simple_model()`.
	"""
    return BatchProvider(
        sources={
            'TEST_input': VanillaSource(numpy.random.uniform(size=(100, 10))),
            'TEST_output': VanillaSource(numpy.random.uniform(size=(100, 1)))
        })
Esempio n. 3
0
def embedding_data():
    """ Returns a small provider that can be used to train the
		`embedding_model()`.
	"""
    return BatchProvider(
        sources={
            'TEST_input':
            VanillaSource(numpy.random.random_integers(0, 99, size=(5, 10))),
            'TEST_output':
            VanillaSource(numpy.random.uniform(size=(5, 3)))
        })
Esempio n. 4
0
def uber_data():
    """ In the land of Mordor, where the shadows lie.
		Data for the uber model.
	"""
    return BatchProvider(
        sources={
            'TEST_input':
            VanillaSource(
                numpy.random.uniform(low=-1, high=1, size=(2, 32, 32))),
            'TEST_output':
            VanillaSource(numpy.random.uniform(low=-1, high=1, size=(2, 140)))
        })
Esempio n. 5
0
def ctc_eval_data(ctc_data):
    """ Provides CTC data with only the evaluation-time input data available.
	"""
    for key, source in zip(ctc_data.keys, ctc_data.sources):
        if key == 'TEST_input':
            return BatchProvider(sources={key: source})