{"action":"created","comment":{"url":"https://api.github.com/repos/tensorflow/models/pulls/comments/214553192","pull_request_review_id":151633061,"id":214553192,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDU1MzE5Mg==","diff_hunk":"@@ -77,9 +77,9 @@ def test_dataset_input_fn(self):\n           self.assertAllClose(pixel, np.array([-1.225, 0., 1.225]), rtol=1e-3)\n \n   def cifar10_model_fn_helper(self, mode, resnet_version, dtype):\n-    input_fn = cifar10_main.get_synth_input_fn()\n+    input_fn = cifar10_main.get_synth_input_fn(dtype)\n     dataset = input_fn(True, '', _BATCH_SIZE)\n-    iterator = dataset.make_one_shot_iterator()\n+    iterator = dataset.make_initializable_iterator()","path":"official/resnet/cifar10_test.py","position":8,"original_position":8,"commit_id":"967133c11ef03207e758b8b3f88f6791a4dd6b6d","original_commit_id":"967133c11ef03207e758b8b3f88f6791a4dd6b6d","user":{"login":"robieta","id":13089297,"node_id":"MDQ6VXNlcjEzMDg5Mjk3","avatar_url":"https://avatars0.githubusercontent.com/u/13089297?v=4","gravatar_id":"","url":"https://api.github.com/users/robieta","html_url":"https://github.com/robieta","followers_url":"https://api.github.com/users/robieta/followers","following_url":"https://api.github.com/users/robieta/following{/other_user}","gists_url":"https://api.github.com/users/robieta/gists{/gist_id}","starred_url":"https://api.github.com/users/robieta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robieta/subscriptions","organizations_url":"https://api.github.com/users/robieta/orgs","repos_url":"https://api.github.com/users/robieta/repos","events_url":"https://api.github.com/users/robieta/events{/privacy}","received_events_url":"https://api.github.com/users/robieta/received_events","type":"User","site_admin":false},"body":"Why was this necessary?","created_at":"2018-09-02T21:16:12Z","updated_at":"2018-09-02T21:16:40Z","html_url":"https://github.com/tensorflow/models/pull/5225#discussion_r214553192","pull_request_url":"https://api.github.com/repos/tensorflow/models/pulls/5225","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tensorflow/models/pulls/comments/214553192"},"html":{"href":"https://github.com/tensorflow/models/pull/5225#discussion_r214553192"},"pull_request":{"href":"https://api.github.com/repos/tensorflow/models/pulls/5225"}}},"pull_request":{"url":"https://api.github.com/repos/tensorflow/models/pulls/5225","id":212598755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTk4NzU1","html_url":"https://github.com/tensorflow/models/pull/5225","diff_url":"https://github.com/tensorflow/models/pull/5225.diff","patch_url":"https://github.com/tensorflow/models/pull/5225.patch","issue_url":"https://api.github.com/repos/tensorflow/models/issues/5225","number":5225,"state":"open","locked":false,"title":"ResNet performance fix","user":{"login":"tfboyd","id":23486130,"node_id":"MDQ6VXNlcjIzNDg2MTMw","avatar_url":"https://avatars1.githubusercontent.com/u/23486130?v=4","gravatar_id":"","url":"https://api.github.com/users/tfboyd","html_url":"https://github.com/tfboyd","followers_url":"https://api.github.com/users/tfboyd/followers","following_url":"https://api.github.com/users/tfboyd/following{/other_user}","gists_url":"https://api.github.com/users/tfboyd/gists{/gist_id}","starred_url":"https://api.github.com/users/tfboyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfboyd/subscriptions","organizations_url":"https://api.github.com/users/tfboyd/orgs","repos_url":"https://api.github.com/users/tfboyd/repos","events_url":"https://api.github.com/users/tfboyd/events{/privacy}","received_events_url":"https://api.github.com/users/tfboyd/received_events","type":"User","site_admin":false},"body":"All numbers are form a DGX-1 with V100s\r\n\r\ntl;dr; I improved synthetic data performance from ~4,800 images/sec to 5,500 images/sec  14.6% speedup on ResNetV1 FP16 maybe more with smaller models.\r\n\r\nThe current Synthetic data has a couple problems.  1) the dtype is set to float32 and is then cast on the GPU (which is something that needs changed for real data a well but is less problematic and I will do a PR for next) no matter what 2) it does not seem to have prefetch.  Both of these combine for a situation where real data is faster than synthetic data:  Real data ~5,200 images/sec ResNet V1 and ~4,800 images/sec synthetic data.  \r\n\r\nDuring my testing I found:\r\n\r\n- Change current code to tf.float16 and leave the tf.cast gets 5,273 images/sec\r\n- Change current code to tf.float16 and remove tf.cast gest 5,329 images/sec.  I have doubts the unneeded cast has any cost in this scenario and could have been noise.  \r\n- Change the input_fn to my solution based on tf_cnn_benchmarks  5,534 images/sec\r\n\r\nThis solution still has the host to device copy, which I believe can only be removed with a custom dataset and I have some doubt it is worth it in the near-term.  \r\n\r\nFor followup work is to move the tf.cast to fp16 for real data as part of the input pipeline and then removing the tf.cast in resnet_run_loop had a small but seemingly consistent improvement.  It also seems more valid and keeps work off the GPU.  \r\n","created_at":"2018-09-02T15:42:55Z","updated_at":"2018-09-02T21:16:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c53e9133e0b99bafb1341708013454396f4f8fb","assignee":null,"assignees":[],"requested_reviewers":[{"login":"karmel","id":667809,"node_id":"MDQ6VXNlcjY2NzgwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/667809?v=4","gravatar_id":"","url":"https://api.github.com/users/karmel","html_url":"https://github.com/karmel","followers_url":"https://api.github.com/users/karmel/followers","following_url":"https://api.github.com/users/karmel/following{/other_user}","gists_url":"https://api.github.com/users/karmel/gists{/gist_id}","starred_url":"https://api.github.com/users/karmel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karmel/subscriptions","organizations_url":"https://api.github.com/users/karmel/orgs","repos_url":"https://api.github.com/users/karmel/repos","events_url":"https://api.github.com/users/karmel/events{/privacy}","received_events_url":"https://api.github.com/users/karmel/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":337864321,"node_id":"MDU6TGFiZWwzMzc4NjQzMjE=","url":"https://api.github.com/repos/tensorflow/models/labels/cla:%20yes","name":"cla: yes","color":"009800","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tensorflow/models/pulls/5225/commits","review_comments_url":"https://api.github.com/repos/tensorflow/models/pulls/5225/comments","review_comment_url":"https://api.github.com/repos/tensorflow/models/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tensorflow/models/issues/5225/comments","statuses_url":"https://api.github.com/repos/tensorflow/models/statuses/967133c11ef03207e758b8b3f88f6791a4dd6b6d","head":{"label":"tfboyd:resnet_synthetic_fix","ref":"resnet_synthetic_fix","sha":"967133c11ef03207e758b8b3f88f6791a4dd6b6d","user":{"login":"tfboyd","id":23486130,"node_id":"MDQ6VXNlcjIzNDg2MTMw","avatar_url":"https://avatars1.githubusercontent.com/u/23486130?v=4","gravatar_id":"","url":"https://api.github.com/users/tfboyd","html_url":"https://github.com/tfboyd","followers_url":"https://api.github.com/users/tfboyd/followers","following_url":"https://api.github.com/users/tfboyd/following{/other_user}","gists_url":"https://api.github.com/users/tfboyd/gists{/gist_id}","starred_url":"https://api.github.com/users/tfboyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfboyd/subscriptions","organizations_url":"https://api.github.com/users/tfboyd/orgs","repos_url":"https://api.github.com/users/tfboyd/repos","events_url":"https://api.github.com/users/tfboyd/events{/privacy}","received_events_url":"https://api.github.com/users/tfboyd/received_events","type":"User","site_admin":false},"repo":{"id":83171764,"node_id":"MDEwOlJlcG9zaXRvcnk4MzE3MTc2NA==","name":"models","full_name":"tfboyd/models","owner":{"login":"tfboyd","id":23486130,"node_id":"MDQ6VXNlcjIzNDg2MTMw","avatar_url":"https://avatars1.githubusercontent.com/u/23486130?v=4","gravatar_id":"","url":"https://api.github.com/users/tfboyd","html_url":"https://github.com/tfboyd","followers_url":"https://api.github.com/users/tfboyd/followers","following_url":"https://api.github.com/users/tfboyd/following{/other_user}","gists_url":"https://api.github.com/users/tfboyd/gists{/gist_id}","starred_url":"https://api.github.com/users/tfboyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfboyd/subscriptions","organizations_url":"https://api.github.com/users/tfboyd/orgs","repos_url":"https://api.github.com/users/tfboyd/repos","events_url":"https://api.github.com/users/tfboyd/events{/privacy}","received_events_url":"https://api.github.com/users/tfboyd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tfboyd/models","description":"Models built with TensorFlow","fork":true,"url":"https://api.github.com/repos/tfboyd/models","forks_url":"https://api.github.com/repos/tfboyd/models/forks","keys_url":"https://api.github.com/repos/tfboyd/models/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tfboyd/models/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tfboyd/models/teams","hooks_url":"https://api.github.com/repos/tfboyd/models/hooks","issue_events_url":"https://api.github.com/repos/tfboyd/models/issues/events{/number}","events_url":"https://api.github.com/repos/tfboyd/models/events","assignees_url":"https://api.github.com/repos/tfboyd/models/assignees{/user}","branches_url":"https://api.github.com/repos/tfboyd/models/branches{/branch}","tags_url":"https://api.github.com/repos/tfboyd/models/tags","blobs_url":"https://api.github.com/repos/tfboyd/models/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tfboyd/models/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tfboyd/models/git/refs{/sha}","trees_url":"https://api.github.com/repos/tfboyd/models/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tfboyd/models/statuses/{sha}","languages_url":"https://api.github.com/repos/tfboyd/models/languages","stargazers_url":"https://api.github.com/repos/tfboyd/models/stargazers","contributors_url":"https://api.github.com/repos/tfboyd/models/contributors","subscribers_url":"https://api.github.com/repos/tfboyd/models/subscribers","subscription_url":"https://api.github.com/repos/tfboyd/models/subscription","commits_url":"https://api.github.com/repos/tfboyd/models/commits{/sha}","git_commits_url":"https://api.github.com/repos/tfboyd/models/git/commits{/sha}","comments_url":"https://api.github.com/repos/tfboyd/models/comments{/number}","issue_comment_url":"https://api.github.com/repos/tfboyd/models/issues/comments{/number}","contents_url":"https://api.github.com/repos/tfboyd/models/contents/{+path}","compare_url":"https://api.github.com/repos/tfboyd/models/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tfboyd/models/merges","archive_url":"https://api.github.com/repos/tfboyd/models/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tfboyd/models/downloads","issues_url":"https://api.github.com/repos/tfboyd/models/issues{/number}","pulls_url":"https://api.github.com/repos/tfboyd/models/pulls{/number}","milestones_url":"https://api.github.com/repos/tfboyd/models/milestones{/number}","notifications_url":"https://api.github.com/repos/tfboyd/models/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tfboyd/models/labels{/name}","releases_url":"https://api.github.com/repos/tfboyd/models/releases{/id}","deployments_url":"https://api.github.com/repos/tfboyd/models/deployments","created_at":"2017-02-26T00:07:42Z","updated_at":"2018-09-01T18:37:06Z","pushed_at":"2018-09-02T15:32:00Z","git_url":"git://github.com/tfboyd/models.git","ssh_url":"git@github.com:tfboyd/models.git","clone_url":"https://github.com/tfboyd/models.git","svn_url":"https://github.com/tfboyd/models","homepage":null,"size":511899,"stargazers_count":1,"watchers_count":1,"language":"Python","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":1,"default_branch":"master"}},"base":{"label":"tensorflow:master","ref":"master","sha":"23b5b4227dfa1b23d7c21f0dfaf0951b16671f43","user":{"login":"tensorflow","id":15658638,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjU4NjM4","avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"repo":{"id":51117837,"node_id":"MDEwOlJlcG9zaXRvcnk1MTExNzgzNw==","name":"models","full_name":"tensorflow/models","owner":{"login":"tensorflow","id":15658638,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1NjU4NjM4","avatar_url":"https://avatars1.githubusercontent.com/u/15658638?v=4","gravatar_id":"","url":"https://api.github.com/users/tensorflow","html_url":"https://github.com/tensorflow","followers_url":"https://api.github.com/users/tensorflow/followers","following_url":"https://api.github.com/users/tensorflow/following{/other_user}","gists_url":"https://api.github.com/users/tensorflow/gists{/gist_id}","starred_url":"https://api.github.com/users/tensorflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tensorflow/subscriptions","organizations_url":"https://api.github.com/users/tensorflow/orgs","repos_url":"https://api.github.com/users/tensorflow/repos","events_url":"https://api.github.com/users/tensorflow/events{/privacy}","received_events_url":"https://api.github.com/users/tensorflow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tensorflow/models","description":"Models and examples built with TensorFlow","fork":false,"url":"https://api.github.com/repos/tensorflow/models","forks_url":"https://api.github.com/repos/tensorflow/models/forks","keys_url":"https://api.github.com/repos/tensorflow/models/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tensorflow/models/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tensorflow/models/teams","hooks_url":"https://api.github.com/repos/tensorflow/models/hooks","issue_events_url":"https://api.github.com/repos/tensorflow/models/issues/events{/number}","events_url":"https://api.github.com/repos/tensorflow/models/events","assignees_url":"https://api.github.com/repos/tensorflow/models/assignees{/user}","branches_url":"https://api.github.com/repos/tensorflow/models/branches{/branch}","tags_url":"https://api.github.com/repos/tensorflow/models/tags","blobs_url":"https://api.github.com/repos/tensorflow/models/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tensorflow/models/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tensorflow/models/git/refs{/sha}","trees_url":"https://api.github.com/repos/tensorflow/models/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tensorflow/models/statuses/{sha}","languages_url":"https://api.github.com/repos/tensorflow/models/languages","stargazers_url":"https://api.github.com/repos/tensorflow/models/stargazers","contributors_url":"https://api.github.com/repos/tensorflow/models/contributors","subscribers_url":"https://api.github.com/repos/tensorflow/models/subscribers","subscription_url":"https://api.github.com/repos/tensorflow/models/subscription","commits_url":"https://api.github.com/repos/tensorflow/models/commits{/sha}","git_commits_url":"https://api.github.com/repos/tensorflow/models/git/commits{/sha}","comments_url":"https://api.github.com/repos/tensorflow/models/comments{/number}","issue_comment_url":"https://api.github.com/repos/tensorflow/models/issues/comments{/number}","contents_url":"https://api.github.com/repos/tensorflow/models/contents/{+path}","compare_url":"https://api.github.com/repos/tensorflow/models/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tensorflow/models/merges","archive_url":"https://api.github.com/repos/tensorflow/models/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tensorflow/models/downloads","issues_url":"https://api.github.com/repos/tensorflow/models/issues{/number}","pulls_url":"https://api.github.com/repos/tensorflow/models/pulls{/number}","milestones_url":"https://api.github.com/repos/tensorflow/models/milestones{/number}","notifications_url":"https://api.github.com/repos/tensorflow/models/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tensorflow/models/labels{/name}","releases_url":"https://api.github.com/repos/tensorflow/models/releases{/id}","deployments_url":"https://api.github.com/repos/tensorflow/models/deployments","created_at":"2016-02-05T01:15:20Z","updated_at":"2018-09-02T21:09:58Z","pushed_at":"2018-09-02T20:17:09Z","git_url":"git://github.com/tensorflow/models.git","ssh_url":"git@github.com:tensorflow/models.git","clone_url":"https://github.com/tensorflow/models.git","svn_url":"https://github.com/tensorflow/models","homepage":"","size":571771,"stargazers_count":40794,"watchers_count":40794,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24292,"mirror_url":null,"archived":false,"open_issues_count":1285,"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":24292,"open_issues":1285,"watchers":40794,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tensorflow/models/pulls/5225"},"html":{"href":"https://github.com/tensorflow/models/pull/5225"},"issue":{"href":"https://api.github.com/repos/tensorflow/models/issues/5225"},"comments":{"href":"https://api.github.com/repos/tensorflow/models/issues/5225/comments"},"review_comments":{"href":"https://api.github.com/repos/tensorflow/models/pulls/5225/comments"},"review_comment":{"href":"https://api.github.com/repos/tensorflow/models/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tensorflow/models/pulls/5225/commits"},"statuses":{"href":"https://api.github.com/repos/tensorflow/models/statuses/967133c11ef03207e758b8b3f88f6791a4dd6b6d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"robieta"}}