)]}'
{
  "commit": "4f5d55beec79cfa7a27c95c823d4255f716b492e",
  "tree": "f4bace898551ac3d6dd374a07527743549faf480",
  "parents": [
    "eca606e48ef900d3723a1e211893538dc9864ec7"
  ],
  "author": {
    "name": "Scott Todd",
    "email": "scotttodd@google.com",
    "time": "Tue Apr 25 09:26:30 2023 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Apr 25 09:26:30 2023 -0700"
  },
  "message": "Handle supported ImportOptions in tf.py and fix Windows compatibility. (#13287)\n\nThis adds back support for `import_only` and `save_temp_iree_input` to\r\nour TensorFlow `compile_saved_model` API. I also removed unsupported\r\noptions (`import_extra_args`, `save_temp_tf_input`,\r\n`save_temp_mid_level_input`, and `use_tosa`).\r\n\r\nThose flags were dropped in https://github.com/openxla/iree/pull/12758 /\r\nhttps://github.com/openxla/iree/pull/13025 , but they are still useful\r\nin Colab notebooks and when debugging tests.\r\n\r\n---\r\n\r\nProgress on https://github.com/openxla/iree/issues/13148, though some\r\nfurther updates will be needed to our Colab notebooks, such as\r\n```python\r\n# before:\r\ncompiler_module \u003d tfc.compile_module(\r\n    EdgeDetectionModule(), import_only\u003dTrue,\r\n    import_extra_args\u003d[\"--output-format\u003dmlir-ir\"])\r\nprint(\"Edge Detection MLIR: \", compiler_module.decode(\u0027utf-8\u0027))\r\n\r\n# after:\r\ncompiler_module \u003d tfc.compile_module(\r\n    EdgeDetectionModule(), import_only\u003dTrue)\r\nprint(\"Edge Detection MLIR: \", compiler_module)\r\n```\r\n\r\n---\r\n\r\nI developed this change on Windows (Yes! Finally, I can use Python that\r\ntouches TF on Windows without needing to build TF from source!), where I\r\nfound that this pattern is broken:\r\n```python\r\n with tempfile.NamedTemporaryFile(mode\u003d\"w\") as temp_file: \r\n   __main__.import_saved_model(output_path\u003dtemp_file.name, \r\n```\r\nSee https://stackoverflow.com/a/23212515 - `NamedTemporaryFile` _creates\r\nand opens_ the file, and the file _cannot be opened again_... on Windows\r\n(it can be opened again on Unix). I used the trick from\r\nhttps://stackoverflow.com/a/45803022 to work around this:\r\n```python\r\nwith tempfile.TemporaryDirectory() as tmpdir:\r\n  # ...\r\n\r\n  # Not saving the file, so generate a loose temp file without tfs.\r\n  tf_iree_input \u003d os.path.join(tmpdir, \u0027tf-iree-input.mlir\u0027)\r\n```",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "085659ecd646e8c6de2ee71a6880ad0792a2bdf5",
      "old_mode": 33188,
      "old_path": "compiler/bindings/python/iree/compiler/tools/tf.py",
      "new_id": "6a49e3172eeb5afb9d346a3a90ef018a92a06e7e",
      "new_mode": 33188,
      "new_path": "compiler/bindings/python/iree/compiler/tools/tf.py"
    },
    {
      "type": "modify",
      "old_id": "7f5e24db113d78559024587a0a6784a02a33dbdf",
      "old_mode": 33188,
      "old_path": "integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py",
      "new_id": "925a2e19f655a671e8ea027ce362ab86b37be450",
      "new_mode": 33188,
      "new_path": "integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py"
    }
  ]
}
