def get_flops(a): session = tf.compat.v1.Session() graph = tf.compat.v1.get_default_graph() with graph.as_default(): with session.as_default(): model = mobilenet_block.MobileNet( input_shape=None, alpha=1.0, depth_multiplier=1, dropout=0.001, include_top=True, weights=None, input_tensor=tf.compat.v1.placeholder('float32', shape=(1, 224, 224, 3)), pooling=None, classes=1000, classifier_activation='softmax', #i_64=1, i_128=1, i_256=1, i_512=1, i_1024=1 i_64=a[0], i_128=a[1], i_256=a[2], i_512=a[3], i_1024=a[4]) run_meta = tf.compat.v1.RunMetadata() opts = tf.compat.v1.profiler.ProfileOptionBuilder.float_operation() flops = tf.compat.v1.profiler.profile(graph=graph, run_meta=run_meta, cmd='op', options=opts) tf.compat.v1.reset_default_graph() return flops.total_float_ops
b = ["i64", "i128", "i256", "i512", "i1024"] FLOPS = [] for i in range(1, 11): for j in range(5): a = [0, 0, 0, 0, 0] a[j] = i model = mobilenet_block.MobileNet(input_shape=None, alpha=1.0, depth_multiplier=1, dropout=0.001, include_top=True, weights=None, input_tensor=None, pooling=None, classes=1000, classifier_activation='softmax', i_64=a[0], i_128=a[1], i_256=a[2], i_512=a[3], i_1024=a[4]) model.compile(optimizer='adam', loss='mean_squared_error', metrics=['accuracy']) history = model.fit(x_train, y_train, epochs=TRAIN_EPOCHS,