Issue 1:
hi, everyone,

We are trying to load a pb file inside Android. The pb file is generated with python 2.7.0 and Tensorflow 1.0.1. We have this following error:

exception triggered java.lang.IllegalArgumentException: No OpKernel was registered to support Op 'FloorMod' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: WCon/atrous_conv2d/mod = FloorMod[T=DT_INT32, _device="/device:CPU:0"](WCon/atrous_conv2d/add_1, WCon/atrous_conv2d/mod/y)]]

The network definition is using tf.nn.atrous_conv2d(i, k, dilation_rate, padding=padding)

And our freezing graph code is also pretty standard.

We have no problem running this pb files for inference with python under Tensorflow 1.0.1

But when running on Android phone, we will see the above error, I tried several nightly build TF Android Inference library including the latest from https://ci.tensorflow.org/view/Nightly/job/nightly-android/ The result is the same

My feeling is that the inference on Tensorflow python and Tensorflow Android has a huge gap?

Thanks for any ideas!

Issue 2:
hi , all! I have tried to load the model inside iOS that I generated from python.

and right now, I have the following problem:

Error adding graph to session:
No OpKernel was registered to support Op 'Less' with these attrs.
Registered devices: [CPU], Registered kernels: device='CPU';
T in [DT_FLOAT] [[Node: rnn/while/Less = Less[T=DT_INT32](rnn/while/Merge, rnn/while/Less/Enter)]]

Here is the python script generating the model:

def add_dynamic_rnn_layer(inputs, out_size, batch_size, Xt_size, time_step, num_layer=1, keep_prob=0.5):
# Reshaping to (batch_size, time_step, Xt_size)
inputs = tf.reshape(inputs, [-1, time_step, Xt_size])
cell = tf.contrib.rnn.MultiRNNCell([tf.contrib.rnn.DropoutWrapper(tf.contrib.rnn.LSTMCell(out_size, state_is_tuple=True,forget_bias=1.0),
input_keep_prob=keep_prob)
for _ in range(num_layer)])
cell = tf.contrib.rnn.DropoutWrapper(cell, input_keep_prob=keep_prob)
sequence_length = np.zeros([batch_size], dtype=int)
sequence_length += time_step
init_state = cell.zero_state(batch_size, tf.float32)
rnn_outputs, final_state = tf.nn.dynamic_rnn(cell, inputs, initial_state=init_state, dtype=tf.float32, time_major=False,sequence_length=sequence_length)
return tf.transpose(rnn_outputs, [1, 0, 2])[-1]

with tf.Session() as sess:
# ...... other model code....
add_dynamic_rnn_layer()
output_graph_def = convert_variables_to_constants(sess, sess.graph_def,
output_node_names=['predictions', 'prediction_labels'])
with tf.gfile.FastGFile('inference'+str(time.time())+'.pb', mode='wb') as f:
f.write(output_graph_def.SerializeToString())

Here is the objective-C++ code loading the model and creating the session:

{
NSString *path = [[NSBundle mainBundle] pathForResource:pbname ofType:@"pb"];
if (!path) return false;
auto status = ReadBinaryProto(tensorflow::Env::Default(), path.fileSystemRepresentation, &graph);
if (!status.ok()) {
NSLog(@"Error reading graph: %s", status.error_message().c_str());
return NO;
}

// This prints out the names of the nodes in the graph.
auto nodeCount = graph.node_size();
NSLog(@"Node count: %d", nodeCount);
for (auto i = 0; i < nodeCount; ++i) {
auto node = graph.node(i);
NSLog(@"Node %d: %s '%s'", i, node.op().c_str(), node.name().c_str());
}

tensorflow::SessionOptions options;
auto status = tensorflow::NewSession(options, &session);
if (!status.ok()) {
NSLog(@"Error creating session: %s", status.error_message().c_str());
return NO;
}

status = session->Create(graph);
if (!status.ok()) {
NSLog(@"Error adding graph to session: %s", status.error_message().c_str());
}
}

the environment as follows:

python 3.5 / xcode 8.3.2

the iOS based on mac os x 10.12 / the tensorflow version: r1.1

the model generated based on Ubuntu / tensorflow is r1.1 gpu version

I have done things as follow:

build_all_ios.sh

success,don't have any warning and error.

set the xcode build settings

header search path

/Users/jw/Desktop/tensorflow non-recursive
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/downloads non-recursive
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/downloads/protobuf/src non-recursive
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/downloads/eigen non-recursive
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/gen/proto non-recursive

other linker flags:

/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/gen/protobuf_ios/lib/libprotobuf.a
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/gen/protobuf_ios/lib/libprotobuf-lite.a
/Users/jw/Desktop/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a
-force_load

check the tf_op_files.txt

have the line tensorflow/core/kernels/cwise_op_less.cc

using the tensorflow version v1.0

have the same error

I would be gratefull if anyone has an idea on why iOS seems to not be able to find the less Op ?

Or the solution to the question : No OpKernel was registered to support Op 'Less' with these attrs.