def run_case(data, checkpoint_dir, use_gateway=True): # reshape data to TF format data = np.transpose(data, (0, 2, 3, 1)) # reset the Graph tf.reset_default_graph() # tf Graph input x = tf.placeholder(tf.float32, shape=data.shape) # Construct model pred = concat_conv_net(x, use_gateway) # Transform to the Intel DAAL model model = pydaal.transform(pred) # Initializing the variables init = tf.global_variables_initializer() # Provide a reference path to PyDAAL model pydaal.dump_model(model, checkpoint_dir) # Create a saver saver = tf.train.Saver(tf.trainable_variables(), max_to_keep=0) # Launch the graph with tf.Session() as sess: sess.run(init) checkpoint_path = os.path.join(checkpoint_dir, 'model.ckpt') saver.save(sess, checkpoint_path, global_step=0) predictions = sess.run(pred, feed_dict={x: data}) return predictions
def run_case(data, checkpoint_dir): # reset the Graph tf.reset_default_graph() # tf Graph input x = tf.placeholder(tf.float32) # Construct model pred = activation_net(x) # Launch the graph with tf.Session() as sess: predictions = sess.run(pred, feed_dict={x: data}) # Transform to the Intel DAAL model model = pydaal.transform(pred) # Provide a reference path to PyDAAL model pydaal.dump_model(model, checkpoint_dir) return predictions