{"action":"created","comment":{"url":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments/221557799","pull_request_review_id":160232090,"id":221557799,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTU1Nzc5OQ==","diff_hunk":"@@ -0,0 +1,86 @@\n+// Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#include \"dali/pipeline/operators/geometric/bb_flip.h\"\n+\n+namespace dali {\n+\n+DALI_REGISTER_OPERATOR(BbFlip, BbFlip, CPU);\n+\n+\n+DALI_SCHEMA(BbFlip)\n+                .DocStr(R\"code(Operator for horizontal flip (mirror) of bounding box.\n+                               Input: Bounding box coordinates; in either (x1,y1,w,h)\n+                               or (x1,y1,x2,y2) format)code\")\n+                .NumInput(1)\n+                .NumOutput(1)\n+                .AddArg(\"coordinates_type\",\n+                        R\"code(True, for width-height representation.\n+                               False for two-point representation.)code\",\n+                        DALI_BOOL);\n+\n+\n+BbFlip::BbFlip(const dali::OpSpec &spec) :\n+        Operator<CPUBackend>(spec),\n+        coordinates_type_wh_(spec.GetArgument<bool>(\"coordinates_type\")) {\n+}\n+\n+\n+void BbFlip::RunImpl(dali::SampleWorkspace *ws, const int idx) {\n+  auto &input = ws->Input<CPUBackend>(idx);\n+  auto input_data = input.data<float>();\n+\n+  DALI_ENFORCE(input.size() == BB_TYPE_SIZE, \"Bounding box in wrong format\");\n+  DALI_ENFORCE(input.type().id() == DALI_FLOAT || input.type().id() == DALI_FLOAT16,\n+               \"Bounding box in wrong format\");\n+\n+  DALI_ENFORCE([](const float *data, size_t size) -> bool {\n+      for (size_t i = 0; i < size; i++) {\n+        if (data[i] < 0 || data[i] > 1.0)\n+          return false;\n+      }\n+      return true;\n+  }(input_data, input.size()), \"Not all bounding box parameters are in [0.0, 1.0]\");\n+\n+  DALI_ENFORCE([](const float *data, size_t size, bool coors_type_wh) -> bool {\n+      if (!coors_type_wh) return true; // Assert not applicable for 2-point representation\n+      for (size_t i = 0; i < size; i += 4) {\n+        if (data[i] + data[i + 2] > 1.0 || data[i + 1] + data[i + 3] > 1.0)\n+          return false;\n+      }\n+      return true;\n+  }(input_data, input.size(), coordinates_type_wh_), \"Incorrect width or height\");\n+\n+\n+  auto output = ws->Output<CPUBackend>(idx);\n+  // XXX: Setting type of output (i.e. Buffer -> buffer.h)\n+  //      explicitly is required for further processing\n+  //      It can also be achieved with mutable_data<>()\n+  //      function.\n+  output->set_type(TypeInfo::Create<float>());\n+  output->Resize({BB_TYPE_SIZE});\n+  auto output_data = output->mutable_data<float>();","path":"dali/pipeline/operators/geometric/bb_flip.cc","position":73,"original_position":73,"commit_id":"19320e7699cbf9ec045b71d1e7f18e4fcd3f8014","original_commit_id":"19320e7699cbf9ec045b71d1e7f18e4fcd3f8014","user":{"login":"pribalta","id":35964727,"node_id":"MDQ6VXNlcjM1OTY0NzI3","avatar_url":"https://avatars1.githubusercontent.com/u/35964727?v=4","gravatar_id":"","url":"https://api.github.com/users/pribalta","html_url":"https://github.com/pribalta","followers_url":"https://api.github.com/users/pribalta/followers","following_url":"https://api.github.com/users/pribalta/following{/other_user}","gists_url":"https://api.github.com/users/pribalta/gists{/gist_id}","starred_url":"https://api.github.com/users/pribalta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pribalta/subscriptions","organizations_url":"https://api.github.com/users/pribalta/orgs","repos_url":"https://api.github.com/users/pribalta/repos","events_url":"https://api.github.com/users/pribalta/events{/privacy}","received_events_url":"https://api.github.com/users/pribalta/received_events","type":"User","site_admin":false},"body":"Some of these autos can be const","created_at":"2018-10-01T10:15:54Z","updated_at":"2018-10-01T10:31:32Z","html_url":"https://github.com/NVIDIA/DALI/pull/188#discussion_r221557799","pull_request_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/188","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments/221557799"},"html":{"href":"https://github.com/NVIDIA/DALI/pull/188#discussion_r221557799"},"pull_request":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/188"}}},"pull_request":{"url":"https://api.github.com/repos/NVIDIA/DALI/pulls/188","id":218685490,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4Njg1NDkw","html_url":"https://github.com/NVIDIA/DALI/pull/188","diff_url":"https://github.com/NVIDIA/DALI/pull/188.diff","patch_url":"https://github.com/NVIDIA/DALI/pull/188.patch","issue_url":"https://api.github.com/repos/NVIDIA/DALI/issues/188","number":188,"state":"open","locked":false,"title":"Bb mirror operator","user":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-27T14:59:13Z","updated_at":"2018-10-01T10:31:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30aeadaeffda9dc5247404a58251be5960ed2567","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ptrendx","id":8398980,"node_id":"MDQ6VXNlcjgzOTg5ODA=","avatar_url":"https://avatars1.githubusercontent.com/u/8398980?v=4","gravatar_id":"","url":"https://api.github.com/users/ptrendx","html_url":"https://github.com/ptrendx","followers_url":"https://api.github.com/users/ptrendx/followers","following_url":"https://api.github.com/users/ptrendx/following{/other_user}","gists_url":"https://api.github.com/users/ptrendx/gists{/gist_id}","starred_url":"https://api.github.com/users/ptrendx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptrendx/subscriptions","organizations_url":"https://api.github.com/users/ptrendx/orgs","repos_url":"https://api.github.com/users/ptrendx/repos","events_url":"https://api.github.com/users/ptrendx/events{/privacy}","received_events_url":"https://api.github.com/users/ptrendx/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/188/commits","review_comments_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/188/comments","review_comment_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NVIDIA/DALI/issues/188/comments","statuses_url":"https://api.github.com/repos/NVIDIA/DALI/statuses/19320e7699cbf9ec045b71d1e7f18e4fcd3f8014","head":{"label":"szalpal:bb_mirror_operator","ref":"bb_mirror_operator","sha":"19320e7699cbf9ec045b71d1e7f18e4fcd3f8014","user":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"repo":{"id":148139188,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgxMzkxODg=","name":"DALI","full_name":"szalpal/DALI","private":false,"owner":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"html_url":"https://github.com/szalpal/DALI","description":"A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications","fork":true,"url":"https://api.github.com/repos/szalpal/DALI","forks_url":"https://api.github.com/repos/szalpal/DALI/forks","keys_url":"https://api.github.com/repos/szalpal/DALI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/szalpal/DALI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/szalpal/DALI/teams","hooks_url":"https://api.github.com/repos/szalpal/DALI/hooks","issue_events_url":"https://api.github.com/repos/szalpal/DALI/issues/events{/number}","events_url":"https://api.github.com/repos/szalpal/DALI/events","assignees_url":"https://api.github.com/repos/szalpal/DALI/assignees{/user}","branches_url":"https://api.github.com/repos/szalpal/DALI/branches{/branch}","tags_url":"https://api.github.com/repos/szalpal/DALI/tags","blobs_url":"https://api.github.com/repos/szalpal/DALI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/szalpal/DALI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/szalpal/DALI/git/refs{/sha}","trees_url":"https://api.github.com/repos/szalpal/DALI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/szalpal/DALI/statuses/{sha}","languages_url":"https://api.github.com/repos/szalpal/DALI/languages","stargazers_url":"https://api.github.com/repos/szalpal/DALI/stargazers","contributors_url":"https://api.github.com/repos/szalpal/DALI/contributors","subscribers_url":"https://api.github.com/repos/szalpal/DALI/subscribers","subscription_url":"https://api.github.com/repos/szalpal/DALI/subscription","commits_url":"https://api.github.com/repos/szalpal/DALI/commits{/sha}","git_commits_url":"https://api.github.com/repos/szalpal/DALI/git/commits{/sha}","comments_url":"https://api.github.com/repos/szalpal/DALI/comments{/number}","issue_comment_url":"https://api.github.com/repos/szalpal/DALI/issues/comments{/number}","contents_url":"https://api.github.com/repos/szalpal/DALI/contents/{+path}","compare_url":"https://api.github.com/repos/szalpal/DALI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/szalpal/DALI/merges","archive_url":"https://api.github.com/repos/szalpal/DALI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/szalpal/DALI/downloads","issues_url":"https://api.github.com/repos/szalpal/DALI/issues{/number}","pulls_url":"https://api.github.com/repos/szalpal/DALI/pulls{/number}","milestones_url":"https://api.github.com/repos/szalpal/DALI/milestones{/number}","notifications_url":"https://api.github.com/repos/szalpal/DALI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/szalpal/DALI/labels{/name}","releases_url":"https://api.github.com/repos/szalpal/DALI/releases{/id}","deployments_url":"https://api.github.com/repos/szalpal/DALI/deployments","created_at":"2018-09-10T10:33:14Z","updated_at":"2018-09-14T13:16:13Z","pushed_at":"2018-09-28T12:17:28Z","git_url":"git://github.com/szalpal/DALI.git","ssh_url":"git@github.com:szalpal/DALI.git","clone_url":"https://github.com/szalpal/DALI.git","svn_url":"https://github.com/szalpal/DALI","homepage":"https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/index.html","size":36577,"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":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NVIDIA:master","ref":"master","sha":"dbecba178eddb24a690dbc241ff5cc366f812366","user":{"login":"NVIDIA","id":1728152,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjgxNTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1728152?v=4","gravatar_id":"","url":"https://api.github.com/users/NVIDIA","html_url":"https://github.com/NVIDIA","followers_url":"https://api.github.com/users/NVIDIA/followers","following_url":"https://api.github.com/users/NVIDIA/following{/other_user}","gists_url":"https://api.github.com/users/NVIDIA/gists{/gist_id}","starred_url":"https://api.github.com/users/NVIDIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NVIDIA/subscriptions","organizations_url":"https://api.github.com/users/NVIDIA/orgs","repos_url":"https://api.github.com/users/NVIDIA/repos","events_url":"https://api.github.com/users/NVIDIA/events{/privacy}","received_events_url":"https://api.github.com/users/NVIDIA/received_events","type":"Organization","site_admin":false},"repo":{"id":135768037,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU3NjgwMzc=","name":"DALI","full_name":"NVIDIA/DALI","private":false,"owner":{"login":"NVIDIA","id":1728152,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjgxNTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1728152?v=4","gravatar_id":"","url":"https://api.github.com/users/NVIDIA","html_url":"https://github.com/NVIDIA","followers_url":"https://api.github.com/users/NVIDIA/followers","following_url":"https://api.github.com/users/NVIDIA/following{/other_user}","gists_url":"https://api.github.com/users/NVIDIA/gists{/gist_id}","starred_url":"https://api.github.com/users/NVIDIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NVIDIA/subscriptions","organizations_url":"https://api.github.com/users/NVIDIA/orgs","repos_url":"https://api.github.com/users/NVIDIA/repos","events_url":"https://api.github.com/users/NVIDIA/events{/privacy}","received_events_url":"https://api.github.com/users/NVIDIA/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/NVIDIA/DALI","description":"A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications","fork":false,"url":"https://api.github.com/repos/NVIDIA/DALI","forks_url":"https://api.github.com/repos/NVIDIA/DALI/forks","keys_url":"https://api.github.com/repos/NVIDIA/DALI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NVIDIA/DALI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NVIDIA/DALI/teams","hooks_url":"https://api.github.com/repos/NVIDIA/DALI/hooks","issue_events_url":"https://api.github.com/repos/NVIDIA/DALI/issues/events{/number}","events_url":"https://api.github.com/repos/NVIDIA/DALI/events","assignees_url":"https://api.github.com/repos/NVIDIA/DALI/assignees{/user}","branches_url":"https://api.github.com/repos/NVIDIA/DALI/branches{/branch}","tags_url":"https://api.github.com/repos/NVIDIA/DALI/tags","blobs_url":"https://api.github.com/repos/NVIDIA/DALI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NVIDIA/DALI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NVIDIA/DALI/git/refs{/sha}","trees_url":"https://api.github.com/repos/NVIDIA/DALI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NVIDIA/DALI/statuses/{sha}","languages_url":"https://api.github.com/repos/NVIDIA/DALI/languages","stargazers_url":"https://api.github.com/repos/NVIDIA/DALI/stargazers","contributors_url":"https://api.github.com/repos/NVIDIA/DALI/contributors","subscribers_url":"https://api.github.com/repos/NVIDIA/DALI/subscribers","subscription_url":"https://api.github.com/repos/NVIDIA/DALI/subscription","commits_url":"https://api.github.com/repos/NVIDIA/DALI/commits{/sha}","git_commits_url":"https://api.github.com/repos/NVIDIA/DALI/git/commits{/sha}","comments_url":"https://api.github.com/repos/NVIDIA/DALI/comments{/number}","issue_comment_url":"https://api.github.com/repos/NVIDIA/DALI/issues/comments{/number}","contents_url":"https://api.github.com/repos/NVIDIA/DALI/contents/{+path}","compare_url":"https://api.github.com/repos/NVIDIA/DALI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NVIDIA/DALI/merges","archive_url":"https://api.github.com/repos/NVIDIA/DALI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NVIDIA/DALI/downloads","issues_url":"https://api.github.com/repos/NVIDIA/DALI/issues{/number}","pulls_url":"https://api.github.com/repos/NVIDIA/DALI/pulls{/number}","milestones_url":"https://api.github.com/repos/NVIDIA/DALI/milestones{/number}","notifications_url":"https://api.github.com/repos/NVIDIA/DALI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NVIDIA/DALI/labels{/name}","releases_url":"https://api.github.com/repos/NVIDIA/DALI/releases{/id}","deployments_url":"https://api.github.com/repos/NVIDIA/DALI/deployments","created_at":"2018-06-01T22:18:01Z","updated_at":"2018-10-01T09:25:56Z","pushed_at":"2018-10-01T08:22:40Z","git_url":"git://github.com/NVIDIA/DALI.git","ssh_url":"git@github.com:NVIDIA/DALI.git","clone_url":"https://github.com/NVIDIA/DALI.git","svn_url":"https://github.com/NVIDIA/DALI","homepage":"https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/index.html","size":36542,"stargazers_count":731,"watchers_count":731,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":79,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":79,"open_issues":23,"watchers":731,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/188"},"html":{"href":"https://github.com/NVIDIA/DALI/pull/188"},"issue":{"href":"https://api.github.com/repos/NVIDIA/DALI/issues/188"},"comments":{"href":"https://api.github.com/repos/NVIDIA/DALI/issues/188/comments"},"review_comments":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/188/comments"},"review_comment":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/188/commits"},"statuses":{"href":"https://api.github.com/repos/NVIDIA/DALI/statuses/19320e7699cbf9ec045b71d1e7f18e4fcd3f8014"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pribalta"}}