Pass allow_custom_ops to toco from the python api.
authorA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 9 Apr 2018 14:37:51 +0000 (07:37 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 9 Apr 2018 14:40:27 +0000 (07:40 -0700)
PiperOrigin-RevId: 192125160

tensorflow/contrib/lite/toco/python/toco_from_protos_test.py
tensorflow/contrib/lite/toco/python/toco_python_api.cc

index c35b6f9..3761e00 100644 (file)
@@ -50,6 +50,7 @@ class TocoFromProtosTest(googletest.TestCase):
     toco_flags.output_format = toco_flags_pb2.TFLITE
     toco_flags.inference_input_type = types_pb2.FLOAT
     toco_flags.inference_type = types_pb2.FLOAT
+    toco_flags.allow_custom_ops = True;
     model_flags = model_flags_pb2.ModelFlags()
     input_array = model_flags.input_arrays.add()
     input_array.name = TensorName(in_tensor)
index 8a5e483..153c117 100644 (file)
@@ -75,7 +75,8 @@ PyObject* TocoConvert(PyObject* model_flags_proto_txt_raw,
       toco::Import(toco_flags, model_flags, input_contents_txt);
   toco::Transform(toco_flags, model.get());
   string output_file_contents_txt;
-  Export(toco_flags, *model, &output_file_contents_txt);
+  Export(toco_flags, *model, toco_flags.allow_custom_ops(),
+         &output_file_contents_txt);
 
   // Convert arguments back to byte (py3) or str (py2)
   return TOCO_FROM_CPPSTRING_TO_PY(output_file_contents_txt.data(),