f2073333b710a340403843763ba60eb1e6699916,examples/data_process/tutorial_fast_affine_transform.py,,example3,#,63

Before Change


    dataset = dataset.map(_map_fn, num_parallel_calls=multiprocessing.cpu_count())
    dataset = dataset.batch(batch_size)  // TODO: consider using tf.contrib.map_and_batch
    dataset = dataset.prefetch(1)  // prefetch 1 batch
    iterator = dataset.make_one_shot_iterator()
    one_element = iterator.get_next()
    sess = tf.Session()
    // feed `one_element` into a network, for demo, we simply get the data as follows
    n_step = round(n_epoch * n_data / batch_size)
    st = time.time()
    for _ in range(n_step):
        _images, _targets = sess.run(one_element)
    print("dataset APIs took %fs for each image" % ((time.time() - st) / batch_size / n_step))  // CPU ~ 100%


def example4():

After Change



    n_step = 0
    st = time.time()
    for img, target in dataset:
        n_step += 1
        pass
    assert n_step == n_epoch * n_data / batch_size
    print("dataset APIs took %fs for each image" % ((time.time() - st) / batch_size / n_step))  // CPU ~ 100%

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: tensorlayer/tensorlayer
Commit Name: f2073333b710a340403843763ba60eb1e6699916
Time: 2019-04-11
Author: rundi_wu@pku.edu.cn
File Name: examples/data_process/tutorial_fast_affine_transform.py
Class Name:
Method Name: example3


Project Name: google-research/language
Commit Name: 12f8fb89877344a669f8ee37c19edef05b7d1676
Time: 2020-04-04
Author: kentonl@google.com
File Name: language/nql/nql/dataset_test.py
Class Name: TestTFDataset
Method Name: as_list


Project Name: calico/basenji
Commit Name: 28f6dbec4bee2572fa7f94445d63cebb2de6dc9b
Time: 2019-09-27
Author: drk@calicolabs.com
File Name: bin/tfr_hdf5.py
Class Name:
Method Name: read_tfr