Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from multiprocessing import Process, Queue
- from keras.utils.test_utils import keras_test
- from keras.utils.test_utils import layer_test
- from keras.utils.generic_utils import CustomObjectScope
- from keras.models import Sequential
- from keras import applications
- from keras import backend as K
- def test_inceptionresnetv2_notop():
- def target(queue):
- model = applications.InceptionResNetV2(weights=None, include_top=False)
- queue.put(model.output_shape)
- global_image_data_format = K.image_data_format()
- queue = Queue()
- K.set_image_data_format('channels_first')
- p = Process(target=target, args=(queue,))
- p.start()
- p.join()
- K.set_image_data_format(global_image_data_format)
- assert not queue.empty(), 'Model creation failed.'
- model_output_shape = queue.get_nowait()
- assert model_output_shape == (None, 1536, None, None)
- K.set_image_data_format('channels_last')
- p = Process(target=target, args=(queue,))
- p.start()
- p.join()
- K.set_image_data_format(global_image_data_format)
- assert not queue.empty(), 'Model creation failed.'
- model_output_shape = queue.get_nowait()
- assert model_output_shape == (None, None, None, 1536)
- import time
- start = time.time()
- test_inceptionresnetv2_notop()
- print('Exec time: ' + str(time.time()-start))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement