{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/vision/pulls/comments/186287457","pull_request_review_id":117840225,"id":186287457,"diff_hunk":"@@ -377,6 +378,13 @@ def __init__(self, size, padding=0, pad_if_needed=False):\n             self.size = (int(size), int(size))\n         else:\n             self.size = size\n+\n+        if isinstance(padding, numbers.Number):","path":"torchvision/transforms/transforms.py","position":15,"original_position":15,"commit_id":"8cc7babd37370a5f4a8f5a504e3037bcf83d09aa","original_commit_id":"8cc7babd37370a5f4a8f5a504e3037bcf83d09aa","user":{"login":"vfdev-5","id":2459423,"avatar_url":"https://avatars0.githubusercontent.com/u/2459423?v=4","gravatar_id":"","url":"https://api.github.com/users/vfdev-5","html_url":"https://github.com/vfdev-5","followers_url":"https://api.github.com/users/vfdev-5/followers","following_url":"https://api.github.com/users/vfdev-5/following{/other_user}","gists_url":"https://api.github.com/users/vfdev-5/gists{/gist_id}","starred_url":"https://api.github.com/users/vfdev-5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vfdev-5/subscriptions","organizations_url":"https://api.github.com/users/vfdev-5/orgs","repos_url":"https://api.github.com/users/vfdev-5/repos","events_url":"https://api.github.com/users/vfdev-5/events{/privacy}","received_events_url":"https://api.github.com/users/vfdev-5/received_events","type":"User","site_admin":false},"body":"@KovenYu I see better the problem, thanks! \r\nThe main bug is in the condition `if self.padding > 0:` and it should be fixed.\r\n\r\nNext, you propose an update of padding argument acceptable value as actually, according to the doc of [`RandomCrop`](https://github.com/pytorch/vision/blob/master/torchvision/transforms/transforms.py#L367) it says:\r\n```\r\npadding (int or sequence, optional): Optional padding on each border\r\n            of the image. Default is 0, i.e no padding. If a sequence of length\r\n            4 is provided, it is used to pad left, top, right, bottom borders\r\n            respectively.\r\n```\r\nso, we logically should not provide a tuple like `(16, 4)`. But as you are right in functional there is an option to set padding as [2-element tuple](https://github.com/pytorch/vision/blob/master/torchvision/transforms/functional.py#L220).\r\nBut as it is said in the doc on padding:\r\n> If tuple of length 2 is provided this is the padding on left/right and top/bottom respectively\r\n\r\nSo it is correct to get in your example `RandomCrop(size=(128, 32), padding=(16, 4))` the result you describe.\r\n\r\nMaybe we need to uniformize all these arguments and fix the condition by setting `padding=None`  instead of `padding=0` as no padding...\r\nWhat do you think ?\r\n","created_at":"2018-05-06T11:38:15Z","updated_at":"2018-05-06T11:38:15Z","html_url":"https://github.com/pytorch/vision/pull/489#discussion_r186287457","pull_request_url":"https://api.github.com/repos/pytorch/vision/pulls/489","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytorch/vision/pulls/comments/186287457"},"html":{"href":"https://github.com/pytorch/vision/pull/489#discussion_r186287457"},"pull_request":{"href":"https://api.github.com/repos/pytorch/vision/pulls/489"}},"in_reply_to_id":186283735},"pull_request":{"url":"https://api.github.com/repos/pytorch/vision/pulls/489","id":186195319,"html_url":"https://github.com/pytorch/vision/pull/489","diff_url":"https://github.com/pytorch/vision/pull/489.diff","patch_url":"https://github.com/pytorch/vision/pull/489.patch","issue_url":"https://api.github.com/repos/pytorch/vision/issues/489","number":489,"state":"open","locked":false,"title":"fix a bug described in issue #488","user":{"login":"KovenYu","id":27218043,"avatar_url":"https://avatars1.githubusercontent.com/u/27218043?v=4","gravatar_id":"","url":"https://api.github.com/users/KovenYu","html_url":"https://github.com/KovenYu","followers_url":"https://api.github.com/users/KovenYu/followers","following_url":"https://api.github.com/users/KovenYu/following{/other_user}","gists_url":"https://api.github.com/users/KovenYu/gists{/gist_id}","starred_url":"https://api.github.com/users/KovenYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KovenYu/subscriptions","organizations_url":"https://api.github.com/users/KovenYu/orgs","repos_url":"https://api.github.com/users/KovenYu/repos","events_url":"https://api.github.com/users/KovenYu/events{/privacy}","received_events_url":"https://api.github.com/users/KovenYu/received_events","type":"User","site_admin":false},"body":"https://github.com/pytorch/vision/issues/488","created_at":"2018-05-06T08:53:41Z","updated_at":"2018-05-06T11:38:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"340187dc4b6c92b2e84758f9b597f7825dd40190","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/vision/pulls/489/commits","review_comments_url":"https://api.github.com/repos/pytorch/vision/pulls/489/comments","review_comment_url":"https://api.github.com/repos/pytorch/vision/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/vision/issues/489/comments","statuses_url":"https://api.github.com/repos/pytorch/vision/statuses/8cc7babd37370a5f4a8f5a504e3037bcf83d09aa","head":{"label":"KovenYu:master","ref":"master","sha":"8cc7babd37370a5f4a8f5a504e3037bcf83d09aa","user":{"login":"KovenYu","id":27218043,"avatar_url":"https://avatars1.githubusercontent.com/u/27218043?v=4","gravatar_id":"","url":"https://api.github.com/users/KovenYu","html_url":"https://github.com/KovenYu","followers_url":"https://api.github.com/users/KovenYu/followers","following_url":"https://api.github.com/users/KovenYu/following{/other_user}","gists_url":"https://api.github.com/users/KovenYu/gists{/gist_id}","starred_url":"https://api.github.com/users/KovenYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KovenYu/subscriptions","organizations_url":"https://api.github.com/users/KovenYu/orgs","repos_url":"https://api.github.com/users/KovenYu/repos","events_url":"https://api.github.com/users/KovenYu/events{/privacy}","received_events_url":"https://api.github.com/users/KovenYu/received_events","type":"User","site_admin":false},"repo":{"id":132319354,"name":"vision","full_name":"KovenYu/vision","owner":{"login":"KovenYu","id":27218043,"avatar_url":"https://avatars1.githubusercontent.com/u/27218043?v=4","gravatar_id":"","url":"https://api.github.com/users/KovenYu","html_url":"https://github.com/KovenYu","followers_url":"https://api.github.com/users/KovenYu/followers","following_url":"https://api.github.com/users/KovenYu/following{/other_user}","gists_url":"https://api.github.com/users/KovenYu/gists{/gist_id}","starred_url":"https://api.github.com/users/KovenYu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KovenYu/subscriptions","organizations_url":"https://api.github.com/users/KovenYu/orgs","repos_url":"https://api.github.com/users/KovenYu/repos","events_url":"https://api.github.com/users/KovenYu/events{/privacy}","received_events_url":"https://api.github.com/users/KovenYu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KovenYu/vision","description":"Datasets, Transforms and Models specific to Computer Vision","fork":true,"url":"https://api.github.com/repos/KovenYu/vision","forks_url":"https://api.github.com/repos/KovenYu/vision/forks","keys_url":"https://api.github.com/repos/KovenYu/vision/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KovenYu/vision/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KovenYu/vision/teams","hooks_url":"https://api.github.com/repos/KovenYu/vision/hooks","issue_events_url":"https://api.github.com/repos/KovenYu/vision/issues/events{/number}","events_url":"https://api.github.com/repos/KovenYu/vision/events","assignees_url":"https://api.github.com/repos/KovenYu/vision/assignees{/user}","branches_url":"https://api.github.com/repos/KovenYu/vision/branches{/branch}","tags_url":"https://api.github.com/repos/KovenYu/vision/tags","blobs_url":"https://api.github.com/repos/KovenYu/vision/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KovenYu/vision/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KovenYu/vision/git/refs{/sha}","trees_url":"https://api.github.com/repos/KovenYu/vision/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KovenYu/vision/statuses/{sha}","languages_url":"https://api.github.com/repos/KovenYu/vision/languages","stargazers_url":"https://api.github.com/repos/KovenYu/vision/stargazers","contributors_url":"https://api.github.com/repos/KovenYu/vision/contributors","subscribers_url":"https://api.github.com/repos/KovenYu/vision/subscribers","subscription_url":"https://api.github.com/repos/KovenYu/vision/subscription","commits_url":"https://api.github.com/repos/KovenYu/vision/commits{/sha}","git_commits_url":"https://api.github.com/repos/KovenYu/vision/git/commits{/sha}","comments_url":"https://api.github.com/repos/KovenYu/vision/comments{/number}","issue_comment_url":"https://api.github.com/repos/KovenYu/vision/issues/comments{/number}","contents_url":"https://api.github.com/repos/KovenYu/vision/contents/{+path}","compare_url":"https://api.github.com/repos/KovenYu/vision/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KovenYu/vision/merges","archive_url":"https://api.github.com/repos/KovenYu/vision/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KovenYu/vision/downloads","issues_url":"https://api.github.com/repos/KovenYu/vision/issues{/number}","pulls_url":"https://api.github.com/repos/KovenYu/vision/pulls{/number}","milestones_url":"https://api.github.com/repos/KovenYu/vision/milestones{/number}","notifications_url":"https://api.github.com/repos/KovenYu/vision/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KovenYu/vision/labels{/name}","releases_url":"https://api.github.com/repos/KovenYu/vision/releases{/id}","deployments_url":"https://api.github.com/repos/KovenYu/vision/deployments","created_at":"2018-05-06T08:14:54Z","updated_at":"2018-05-06T08:51:15Z","pushed_at":"2018-05-06T08:51:13Z","git_url":"git://github.com/KovenYu/vision.git","ssh_url":"git@github.com:KovenYu/vision.git","clone_url":"https://github.com/KovenYu/vision.git","svn_url":"https://github.com/KovenYu/vision","homepage":null,"size":2088,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","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":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"4db0398a2b02aae790013efbc868f2d795eb2ef7","user":{"login":"pytorch","id":21003710,"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":73328905,"name":"vision","full_name":"pytorch/vision","owner":{"login":"pytorch","id":21003710,"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/vision","description":"Datasets, Transforms and Models specific to Computer Vision","fork":false,"url":"https://api.github.com/repos/pytorch/vision","forks_url":"https://api.github.com/repos/pytorch/vision/forks","keys_url":"https://api.github.com/repos/pytorch/vision/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/vision/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/vision/teams","hooks_url":"https://api.github.com/repos/pytorch/vision/hooks","issue_events_url":"https://api.github.com/repos/pytorch/vision/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/vision/events","assignees_url":"https://api.github.com/repos/pytorch/vision/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/vision/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/vision/tags","blobs_url":"https://api.github.com/repos/pytorch/vision/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/vision/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/vision/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/vision/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/vision/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/vision/languages","stargazers_url":"https://api.github.com/repos/pytorch/vision/stargazers","contributors_url":"https://api.github.com/repos/pytorch/vision/contributors","subscribers_url":"https://api.github.com/repos/pytorch/vision/subscribers","subscription_url":"https://api.github.com/repos/pytorch/vision/subscription","commits_url":"https://api.github.com/repos/pytorch/vision/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/vision/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/vision/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/vision/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/vision/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/vision/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/vision/merges","archive_url":"https://api.github.com/repos/pytorch/vision/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/vision/downloads","issues_url":"https://api.github.com/repos/pytorch/vision/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/vision/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/vision/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/vision/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/vision/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/vision/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/vision/deployments","created_at":"2016-11-09T23:11:43Z","updated_at":"2018-05-06T10:34:06Z","pushed_at":"2018-05-06T08:53:42Z","git_url":"git://github.com/pytorch/vision.git","ssh_url":"git@github.com:pytorch/vision.git","clone_url":"https://github.com/pytorch/vision.git","svn_url":"https://github.com/pytorch/vision","homepage":null,"size":2087,"stargazers_count":1481,"watchers_count":1481,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":660,"mirror_url":null,"archived":false,"open_issues_count":86,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":660,"open_issues":86,"watchers":1481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/vision/pulls/489"},"html":{"href":"https://github.com/pytorch/vision/pull/489"},"issue":{"href":"https://api.github.com/repos/pytorch/vision/issues/489"},"comments":{"href":"https://api.github.com/repos/pytorch/vision/issues/489/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/vision/pulls/489/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/vision/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/vision/pulls/489/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/vision/statuses/8cc7babd37370a5f4a8f5a504e3037bcf83d09aa"}},"author_association":"NONE"}}
{"actor":{"display_login":"vfdev-5"}}