{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22409","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22409/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22409/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22409/events","html_url":"https://github.com/tensorflow/tensorflow/issues/22409","id":362144579,"node_id":"MDU6SXNzdWUzNjIxNDQ1Nzk=","number":22409,"title":"ValueError: Cannot set tensor: Got tensor of type 4 but expected type 2 for input 25","user":{"login":"theavgguy","id":19423622,"node_id":"MDQ6VXNlcjE5NDIzNjIy","avatar_url":"https://avatars0.githubusercontent.com/u/19423622?v=4","gravatar_id":"","url":"https://api.github.com/users/theavgguy","html_url":"https://github.com/theavgguy","followers_url":"https://api.github.com/users/theavgguy/followers","following_url":"https://api.github.com/users/theavgguy/following{/other_user}","gists_url":"https://api.github.com/users/theavgguy/gists{/gist_id}","starred_url":"https://api.github.com/users/theavgguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theavgguy/subscriptions","organizations_url":"https://api.github.com/users/theavgguy/orgs","repos_url":"https://api.github.com/users/theavgguy/repos","events_url":"https://api.github.com/users/theavgguy/events{/privacy}","received_events_url":"https://api.github.com/users/theavgguy/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":"0052cc","default":false},{"id":386191887,"node_id":"MDU6TGFiZWwzODYxOTE4ODc=","url":"https://api.github.com/repos/tensorflow/tensorflow/labels/stat:awaiting%20response","name":"stat:awaiting response","color":"f4b400","default":false}],"state":"closed","locked":false,"assignee":{"login":"wt-huang","id":42785337,"node_id":"MDQ6VXNlcjQyNzg1MzM3","avatar_url":"https://avatars0.githubusercontent.com/u/42785337?v=4","gravatar_id":"","url":"https://api.github.com/users/wt-huang","html_url":"https://github.com/wt-huang","followers_url":"https://api.github.com/users/wt-huang/followers","following_url":"https://api.github.com/users/wt-huang/following{/other_user}","gists_url":"https://api.github.com/users/wt-huang/gists{/gist_id}","starred_url":"https://api.github.com/users/wt-huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wt-huang/subscriptions","organizations_url":"https://api.github.com/users/wt-huang/orgs","repos_url":"https://api.github.com/users/wt-huang/repos","events_url":"https://api.github.com/users/wt-huang/events{/privacy}","received_events_url":"https://api.github.com/users/wt-huang/received_events","type":"User","site_admin":false},"assignees":[{"login":"wt-huang","id":42785337,"node_id":"MDQ6VXNlcjQyNzg1MzM3","avatar_url":"https://avatars0.githubusercontent.com/u/42785337?v=4","gravatar_id":"","url":"https://api.github.com/users/wt-huang","html_url":"https://github.com/wt-huang","followers_url":"https://api.github.com/users/wt-huang/followers","following_url":"https://api.github.com/users/wt-huang/following{/other_user}","gists_url":"https://api.github.com/users/wt-huang/gists{/gist_id}","starred_url":"https://api.github.com/users/wt-huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wt-huang/subscriptions","organizations_url":"https://api.github.com/users/wt-huang/orgs","repos_url":"https://api.github.com/users/wt-huang/repos","events_url":"https://api.github.com/users/wt-huang/events{/privacy}","received_events_url":"https://api.github.com/users/wt-huang/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-09-20T11:30:36Z","updated_at":"2018-10-24T02:02:28Z","closed_at":"2018-09-29T03:38:43Z","author_association":"NONE","body":"I am trying to run a tensorflow model on device, using tensorflow lite. I was able to convert my .pb graph to a .lite graph. Using python interpreter as below\r\n\r\n`interpreter = interpreter_wrapper.Interpreter(model_path=model_file)\r\ninterpreter.allocate_tensors()\r\n\r\ninput_details = interpreter.get_input_details()\r\noutput_details = interpreter.get_output_details()\r\ninterpreter.set_tensor(input_details[0]['index'], candidates)`\r\n\r\nthe above code throws following error : ValueError: Cannot set tensor: Got tensor of type 4 but expected type 2 for input 25\r\n\r\nI have no clue what tensor of type 4 and tensor of type 2 are, I am not sure if they are same as tensor ranks, in my case, the tensor ranks and types mentioned above don't seem to be the same."},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/432484940","html_url":"https://github.com/tensorflow/tensorflow/issues/22409#issuecomment-432484940","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22409","id":432484940,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjQ4NDk0MA==","user":{"login":"oneTaken","id":18045872,"node_id":"MDQ6VXNlcjE4MDQ1ODcy","avatar_url":"https://avatars1.githubusercontent.com/u/18045872?v=4","gravatar_id":"","url":"https://api.github.com/users/oneTaken","html_url":"https://github.com/oneTaken","followers_url":"https://api.github.com/users/oneTaken/followers","following_url":"https://api.github.com/users/oneTaken/following{/other_user}","gists_url":"https://api.github.com/users/oneTaken/gists{/gist_id}","starred_url":"https://api.github.com/users/oneTaken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oneTaken/subscriptions","organizations_url":"https://api.github.com/users/oneTaken/orgs","repos_url":"https://api.github.com/users/oneTaken/repos","events_url":"https://api.github.com/users/oneTaken/events{/privacy}","received_events_url":"https://api.github.com/users/oneTaken/received_events","type":"User","site_admin":false},"created_at":"2018-10-24T02:02:28Z","updated_at":"2018-10-24T02:02:28Z","author_association":"NONE","body":"@theavgguy \r\nHello, I got this problem too.  \r\nAnd I debug and find that type 2 or 4 in your case is the data type of the internal encoding which you can find clearly [here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/python/interpreter_wrapper/interpreter_wrapper.cc#L142~L166). So you just need to cast your tensor with the same data type of your input.  \r\n\r\nHope that help you."}}
{"actor":{"display_login":"oneTaken"}}