{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19169","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19169/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19169/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19169/events","html_url":"https://github.com/tensorflow/tensorflow/issues/19169","id":321427386,"node_id":"MDU6SXNzdWUzMjE0MjczODY=","number":19169,"title":"Problem of fusing CONV-BN-RELU together of TF-Lite","user":{"login":"HwMohanLiu","id":34759453,"node_id":"MDQ6VXNlcjM0NzU5NDUz","avatar_url":"https://avatars3.githubusercontent.com/u/34759453?v=4","gravatar_id":"","url":"https://api.github.com/users/HwMohanLiu","html_url":"https://github.com/HwMohanLiu","followers_url":"https://api.github.com/users/HwMohanLiu/followers","following_url":"https://api.github.com/users/HwMohanLiu/following{/other_user}","gists_url":"https://api.github.com/users/HwMohanLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/HwMohanLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HwMohanLiu/subscriptions","organizations_url":"https://api.github.com/users/HwMohanLiu/orgs","repos_url":"https://api.github.com/users/HwMohanLiu/repos","events_url":"https://api.github.com/users/HwMohanLiu/events{/privacy}","received_events_url":"https://api.github.com/users/HwMohanLiu/received_events","type":"User","site_admin":false},"labels":[{"id":750616506,"node_id":"MDU6TGFiZWw3NTA2MTY1MDY=","url":"https://api.github.com/repos/tensorflow/tensorflow/labels/comp:lite","name":"comp:lite","color":"e99695","default":false}],"state":"open","locked":false,"assignee":{"login":"suharshs","id":1450614,"node_id":"MDQ6VXNlcjE0NTA2MTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1450614?v=4","gravatar_id":"","url":"https://api.github.com/users/suharshs","html_url":"https://github.com/suharshs","followers_url":"https://api.github.com/users/suharshs/followers","following_url":"https://api.github.com/users/suharshs/following{/other_user}","gists_url":"https://api.github.com/users/suharshs/gists{/gist_id}","starred_url":"https://api.github.com/users/suharshs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suharshs/subscriptions","organizations_url":"https://api.github.com/users/suharshs/orgs","repos_url":"https://api.github.com/users/suharshs/repos","events_url":"https://api.github.com/users/suharshs/events{/privacy}","received_events_url":"https://api.github.com/users/suharshs/received_events","type":"User","site_admin":false},"assignees":[{"login":"suharshs","id":1450614,"node_id":"MDQ6VXNlcjE0NTA2MTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1450614?v=4","gravatar_id":"","url":"https://api.github.com/users/suharshs","html_url":"https://github.com/suharshs","followers_url":"https://api.github.com/users/suharshs/followers","following_url":"https://api.github.com/users/suharshs/following{/other_user}","gists_url":"https://api.github.com/users/suharshs/gists{/gist_id}","starred_url":"https://api.github.com/users/suharshs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suharshs/subscriptions","organizations_url":"https://api.github.com/users/suharshs/orgs","repos_url":"https://api.github.com/users/suharshs/repos","events_url":"https://api.github.com/users/suharshs/events{/privacy}","received_events_url":"https://api.github.com/users/suharshs/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-05-09T04:34:13Z","updated_at":"2018-07-27T18:53:31Z","closed_at":null,"author_association":"NONE","body":"### System information\r\n- **Have I written custom code (as opposed to using a stock example script provided in TensorFlow)**: No\r\n- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Ubuntu16.04\r\n- **TensorFlow installed from (source or binary)**: source\r\n- **TensorFlow version (use command below)**: 1.7\r\n- **Python version**: 3.5\r\n- **Bazel version (if compiling from source)**: 0.11.0\r\n- **GCC/Compiler version (if compiling from source)**: 4.9\r\n- **CUDA/cuDNN version**: 9.0\r\n- **GPU model and memory**: 16GB\r\n- **Exact command to reproduce**:\r\n\r\n### Describe the problem\r\nBN-RELU-CONV structure is becoming more popular recently. However, for TF-Lite, if there are frequent BN-RELU-CONV structures in the graph, the (BN-RELU-CONV) * N sequence will be matched as BN-RELU-(CONV-BN-RELU) * (N-1) - CONV sequence. To make TOCO tools work, it is simply to add an additional 1x1 CONV op at the very beginning, such like conv-(BN-RELU-CONV) * N. Then, it will be  conv-BN-RELU-(CONV-BN-RELU) * (N-1) -CONV and TOCO can fuse them. However, the shapes between CONV in first block and BN-RELU in second block could be not matched. Thus, it will be crashed during the runtime. The single way to solve this problem is to add an 1x1 conv in front of every BN-RELU-CONV strcture. However, this changes too much from the original model. Thus, in my opinion, fusion of CONV-BN-RELU ops should not be hard coded. \r\n\r\nI am not sure that this problem only occurs in TF-Lite. It seems that the BN folding method of TF graph_transform will also match the corresponding CONV-BN structure at first.\r\n\r\n### Source code / logs\r\nFor example, DenseNet:\r\nRuntime Error:\r\n> java.lang.NullPointerException: Can not allocate memory for the given inputs: third_party/tensorflow/contrib/lite/kernels/mul.cc:48 NumDimensions(input1) != NumDimensions(input2) (4 != 1)\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/408508647","html_url":"https://github.com/tensorflow/tensorflow/issues/19169#issuecomment-408508647","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/19169","id":408508647,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODUwODY0Nw==","user":{"login":"tensorflowbutler","id":28546240,"node_id":"MDQ6VXNlcjI4NTQ2MjQw","avatar_url":"https://avatars2.githubusercontent.com/u/28546240?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflowbutler","html_url":"https://github.com/tensorflowbutler","followers_url":"https://api.github.com/users/tensorflowbutler/followers","following_url":"https://api.github.com/users/tensorflowbutler/following{/other_user}","gists_url":"https://api.github.com/users/tensorflowbutler/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflowbutler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflowbutler/subscriptions","organizations_url":"https://api.github.com/users/tensorflowbutler/orgs","repos_url":"https://api.github.com/users/tensorflowbutler/repos","events_url":"https://api.github.com/users/tensorflowbutler/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflowbutler/received_events","type":"User","site_admin":false},"created_at":"2018-07-27T18:53:31Z","updated_at":"2018-07-27T18:53:31Z","author_association":"MEMBER","body":"Nagging Assignee @suharshs: It has been 44 days with no activity and this issue has an assignee. Please update the label and/or status accordingly."}}
{"actor":{"display_login":"tensorflowbutler"}}