{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/glow/pulls/comments/214100546","pull_request_review_id":151082778,"id":214100546,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDEwMDU0Ng==","diff_hunk":"@@ -83,11 +83,18 @@ llvm::cl::opt<ImageNormalizationMode> imageMode(\n llvm::cl::alias imageModeA(\"i\", llvm::cl::desc(\"Alias for -image_mode\"),\n                            llvm::cl::aliasopt(imageMode),\n                            llvm::cl::cat(imageLoaderCat));\n+\n+\n+llvm::cl::opt<std::string> loadimageFormat(","path":"tools/loader/ImageClassifier.cpp","position":6,"original_position":6,"commit_id":"5ff54f73df50367a5824cc76ff0a7ca0ef59830c","original_commit_id":"5ff54f73df50367a5824cc76ff0a7ca0ef59830c","user":{"login":"dmoham1476","id":14185005,"node_id":"MDQ6VXNlcjE0MTg1MDA1","avatar_url":"https://avatars3.githubusercontent.com/u/14185005?v=4","gravatar_id":"","url":"https://api.github.com/users/dmoham1476","html_url":"https://github.com/dmoham1476","followers_url":"https://api.github.com/users/dmoham1476/followers","following_url":"https://api.github.com/users/dmoham1476/following{/other_user}","gists_url":"https://api.github.com/users/dmoham1476/gists{/gist_id}","starred_url":"https://api.github.com/users/dmoham1476/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmoham1476/subscriptions","organizations_url":"https://api.github.com/users/dmoham1476/orgs","repos_url":"https://api.github.com/users/dmoham1476/repos","events_url":"https://api.github.com/users/dmoham1476/events{/privacy}","received_events_url":"https://api.github.com/users/dmoham1476/received_events","type":"User","site_admin":false},"body":"Hi Jordon, \r\n\r\nI made the following changes - \r\nenum class ImageLayout {\r\n  /// N x C x H x W \r\n  NCHW,\r\n  /// N x H x W x C\r\n  NHWC,\r\n};\r\nImageLayout strToImageLayout(const std::string &str) {\r\n  return llvm::StringSwitch<ImageLayout>(str)\r\n      .Case(\"nhwc\", ImageLayout::NHWC)\r\n      .Case(\"nchw\", ImageLayout::NCHW);\r\n  GLOW_ASSERT(false && \"Unknown image layout\");\r\n}\r\nllvm::cl::opt<ImageLayout> imageLayout(\r\n    \"image_layout\", llvm::cl::desc(\"Specify which image layout to use\"), \r\n    llvm::cl::Optional,\r\n    llvm::cl::values(\r\n        clEnumValN(ImageLayout::NCHW, \"nchw\",\r\n                   \"Use NCHW image layout\"),\r\n        clEnumValN(ImageLayout::NHWC, \"nhwc\",\r\n                   \"Use NHWC image layout\")),\r\n    llvm::cl::init(ImageLayout::NCHW));\r\n\r\nI can see that it is being passed on the command line correctly, I am using the CLI passed in this function - \r\nvoid loadImagesAndPreprocess(const llvm::cl::list<std::string> &filenames,\r\n                             Tensor *result, ImageNormalizationMode normMode, ImageLayout layout) \r\n\r\nswitch (layout) {\r\n  case ImageLayout::NCHW:\r\n    result->reset(ElemKind::FloatTy,\r\n                {numImages, numChannels, imgHeight, imgWidth});\r\n  case ImageLayout::NHWC:\r\n    result->reset(ElemKind::FloatTy,\r\n                {numImages, imgHeight, imgWidth, numChannels});\r\n  default:\r\n    GLOW_ASSERT(false && \"Invalid Image Layout\");\r\n  }\r\n\r\nI can see that the command line parameter takes in 0 for nchw and 1 for nhwc, when I print it inside this function. However, it is not being matched correctly in the switch/case (although the enum also takes int values). I am puzzled that I am missing some link here. I referred to the imageMode code and I cannot figure where the strToImageNormalizationMode function is being called or if it is needed. \r\n","created_at":"2018-08-30T16:39:20Z","updated_at":"2018-08-30T16:39:20Z","html_url":"https://github.com/pytorch/glow/pull/1558#discussion_r214100546","pull_request_url":"https://api.github.com/repos/pytorch/glow/pulls/1558","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/pytorch/glow/pulls/comments/214100546"},"html":{"href":"https://github.com/pytorch/glow/pull/1558#discussion_r214100546"},"pull_request":{"href":"https://api.github.com/repos/pytorch/glow/pulls/1558"}},"in_reply_to_id":213381484},"pull_request":{"url":"https://api.github.com/repos/pytorch/glow/pulls/1558","id":211299970,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExMjk5OTcw","html_url":"https://github.com/pytorch/glow/pull/1558","diff_url":"https://github.com/pytorch/glow/pull/1558.diff","patch_url":"https://github.com/pytorch/glow/pull/1558.patch","issue_url":"https://api.github.com/repos/pytorch/glow/issues/1558","number":1558,"state":"open","locked":false,"title":"[Loader] Changes to support ONNX graphs generated from tensorflow in NHWC format","user":{"login":"dmoham1476","id":14185005,"node_id":"MDQ6VXNlcjE0MTg1MDA1","avatar_url":"https://avatars3.githubusercontent.com/u/14185005?v=4","gravatar_id":"","url":"https://api.github.com/users/dmoham1476","html_url":"https://github.com/dmoham1476","followers_url":"https://api.github.com/users/dmoham1476/followers","following_url":"https://api.github.com/users/dmoham1476/following{/other_user}","gists_url":"https://api.github.com/users/dmoham1476/gists{/gist_id}","starred_url":"https://api.github.com/users/dmoham1476/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmoham1476/subscriptions","organizations_url":"https://api.github.com/users/dmoham1476/orgs","repos_url":"https://api.github.com/users/dmoham1476/repos","events_url":"https://api.github.com/users/dmoham1476/events{/privacy}","received_events_url":"https://api.github.com/users/dmoham1476/received_events","type":"User","site_admin":false},"body":"*Description*:\r\nGLOW compiler supports caffe2 and ONNX models in NCHW format. Using tf2onnx, ONNX graphs can be generated from tensorflow checkpoints. The input to the graph in this case is in the NHWC format.  The ONNX graphs generated from tensorflow models also have some operators like tf.Identity and tf.MatMul that is not currently supported by the GLOW compiler ONNX code. The pull request is for the changes to support this additional feature for googlenet_v1_slim.onnx and google_v4_slim.onnx generated from tensorflow pretrained models. \r\n\r\n*Testing*: Ran tests/images/run.sh, ran ninja test, all tests passed with \"-DGLOW_WITH_OPENCL=OFF -DGLOW_WITH_CPU=OFF\r\n\r\n*Documentation*: tf2onnx tool - https://github.com/onnx/tensorflow-onnx/tree/master/tf2onnx\r\nPretrained googlenet models - https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models\r\n","created_at":"2018-08-28T04:44:09Z","updated_at":"2018-08-30T16:39:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44bfcdf9e4c454a884ac35fb51150dd4ed98915e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":706497924,"node_id":"MDU6TGFiZWw3MDY0OTc5MjQ=","url":"https://api.github.com/repos/pytorch/glow/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/glow/pulls/1558/commits","review_comments_url":"https://api.github.com/repos/pytorch/glow/pulls/1558/comments","review_comment_url":"https://api.github.com/repos/pytorch/glow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/glow/issues/1558/comments","statuses_url":"https://api.github.com/repos/pytorch/glow/statuses/5ff54f73df50367a5824cc76ff0a7ca0ef59830c","head":{"label":"dmoham1476:master","ref":"master","sha":"5ff54f73df50367a5824cc76ff0a7ca0ef59830c","user":{"login":"dmoham1476","id":14185005,"node_id":"MDQ6VXNlcjE0MTg1MDA1","avatar_url":"https://avatars3.githubusercontent.com/u/14185005?v=4","gravatar_id":"","url":"https://api.github.com/users/dmoham1476","html_url":"https://github.com/dmoham1476","followers_url":"https://api.github.com/users/dmoham1476/followers","following_url":"https://api.github.com/users/dmoham1476/following{/other_user}","gists_url":"https://api.github.com/users/dmoham1476/gists{/gist_id}","starred_url":"https://api.github.com/users/dmoham1476/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmoham1476/subscriptions","organizations_url":"https://api.github.com/users/dmoham1476/orgs","repos_url":"https://api.github.com/users/dmoham1476/repos","events_url":"https://api.github.com/users/dmoham1476/events{/privacy}","received_events_url":"https://api.github.com/users/dmoham1476/received_events","type":"User","site_admin":false},"repo":{"id":146326461,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYzMjY0NjE=","name":"glow","full_name":"dmoham1476/glow","owner":{"login":"dmoham1476","id":14185005,"node_id":"MDQ6VXNlcjE0MTg1MDA1","avatar_url":"https://avatars3.githubusercontent.com/u/14185005?v=4","gravatar_id":"","url":"https://api.github.com/users/dmoham1476","html_url":"https://github.com/dmoham1476","followers_url":"https://api.github.com/users/dmoham1476/followers","following_url":"https://api.github.com/users/dmoham1476/following{/other_user}","gists_url":"https://api.github.com/users/dmoham1476/gists{/gist_id}","starred_url":"https://api.github.com/users/dmoham1476/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmoham1476/subscriptions","organizations_url":"https://api.github.com/users/dmoham1476/orgs","repos_url":"https://api.github.com/users/dmoham1476/repos","events_url":"https://api.github.com/users/dmoham1476/events{/privacy}","received_events_url":"https://api.github.com/users/dmoham1476/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmoham1476/glow","description":"Compiler for Neural Network hardware accelerators","fork":true,"url":"https://api.github.com/repos/dmoham1476/glow","forks_url":"https://api.github.com/repos/dmoham1476/glow/forks","keys_url":"https://api.github.com/repos/dmoham1476/glow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmoham1476/glow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmoham1476/glow/teams","hooks_url":"https://api.github.com/repos/dmoham1476/glow/hooks","issue_events_url":"https://api.github.com/repos/dmoham1476/glow/issues/events{/number}","events_url":"https://api.github.com/repos/dmoham1476/glow/events","assignees_url":"https://api.github.com/repos/dmoham1476/glow/assignees{/user}","branches_url":"https://api.github.com/repos/dmoham1476/glow/branches{/branch}","tags_url":"https://api.github.com/repos/dmoham1476/glow/tags","blobs_url":"https://api.github.com/repos/dmoham1476/glow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmoham1476/glow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmoham1476/glow/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmoham1476/glow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmoham1476/glow/statuses/{sha}","languages_url":"https://api.github.com/repos/dmoham1476/glow/languages","stargazers_url":"https://api.github.com/repos/dmoham1476/glow/stargazers","contributors_url":"https://api.github.com/repos/dmoham1476/glow/contributors","subscribers_url":"https://api.github.com/repos/dmoham1476/glow/subscribers","subscription_url":"https://api.github.com/repos/dmoham1476/glow/subscription","commits_url":"https://api.github.com/repos/dmoham1476/glow/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmoham1476/glow/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmoham1476/glow/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmoham1476/glow/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmoham1476/glow/contents/{+path}","compare_url":"https://api.github.com/repos/dmoham1476/glow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmoham1476/glow/merges","archive_url":"https://api.github.com/repos/dmoham1476/glow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmoham1476/glow/downloads","issues_url":"https://api.github.com/repos/dmoham1476/glow/issues{/number}","pulls_url":"https://api.github.com/repos/dmoham1476/glow/pulls{/number}","milestones_url":"https://api.github.com/repos/dmoham1476/glow/milestones{/number}","notifications_url":"https://api.github.com/repos/dmoham1476/glow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmoham1476/glow/labels{/name}","releases_url":"https://api.github.com/repos/dmoham1476/glow/releases{/id}","deployments_url":"https://api.github.com/repos/dmoham1476/glow/deployments","created_at":"2018-08-27T16:46:59Z","updated_at":"2018-08-27T18:19:25Z","pushed_at":"2018-08-27T18:19:23Z","git_url":"git://github.com/dmoham1476/glow.git","ssh_url":"git@github.com:dmoham1476/glow.git","clone_url":"https://github.com/dmoham1476/glow.git","svn_url":"https://github.com/dmoham1476/glow","homepage":null,"size":7916,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"72acd4817b566a255484bf0a756bc42a2b02ffa9","user":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"repo":{"id":105281531,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUyODE1MzE=","name":"glow","full_name":"pytorch/glow","owner":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pytorch/glow","description":"Compiler for Neural Network hardware accelerators","fork":false,"url":"https://api.github.com/repos/pytorch/glow","forks_url":"https://api.github.com/repos/pytorch/glow/forks","keys_url":"https://api.github.com/repos/pytorch/glow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/glow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/glow/teams","hooks_url":"https://api.github.com/repos/pytorch/glow/hooks","issue_events_url":"https://api.github.com/repos/pytorch/glow/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/glow/events","assignees_url":"https://api.github.com/repos/pytorch/glow/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/glow/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/glow/tags","blobs_url":"https://api.github.com/repos/pytorch/glow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/glow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/glow/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/glow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/glow/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/glow/languages","stargazers_url":"https://api.github.com/repos/pytorch/glow/stargazers","contributors_url":"https://api.github.com/repos/pytorch/glow/contributors","subscribers_url":"https://api.github.com/repos/pytorch/glow/subscribers","subscription_url":"https://api.github.com/repos/pytorch/glow/subscription","commits_url":"https://api.github.com/repos/pytorch/glow/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/glow/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/glow/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/glow/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/glow/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/glow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/glow/merges","archive_url":"https://api.github.com/repos/pytorch/glow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/glow/downloads","issues_url":"https://api.github.com/repos/pytorch/glow/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/glow/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/glow/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/glow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/glow/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/glow/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/glow/deployments","created_at":"2017-09-29T14:28:18Z","updated_at":"2018-08-30T08:28:10Z","pushed_at":"2018-08-30T13:36:05Z","git_url":"git://github.com/pytorch/glow.git","ssh_url":"git@github.com:pytorch/glow.git","clone_url":"https://github.com/pytorch/glow.git","svn_url":"https://github.com/pytorch/glow","homepage":null,"size":7966,"stargazers_count":705,"watchers_count":705,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":86,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":86,"open_issues":51,"watchers":705,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/glow/pulls/1558"},"html":{"href":"https://github.com/pytorch/glow/pull/1558"},"issue":{"href":"https://api.github.com/repos/pytorch/glow/issues/1558"},"comments":{"href":"https://api.github.com/repos/pytorch/glow/issues/1558/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/glow/pulls/1558/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/glow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/glow/pulls/1558/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/glow/statuses/5ff54f73df50367a5824cc76ff0a7ca0ef59830c"}},"author_association":"NONE"}}
{"actor":{"display_login":"dmoham1476"}}