{"action":"created","comment":{"url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/comments/97977036","pull_request_review_id":18602454,"id":97977036,"diff_hunk":"@@ -0,0 +1,155 @@\n+\n+static void tensorDiag(rpc::RPCMessage& raw_message) {\n+  Tensor *r = unpackRetrieveTensor(raw_message);\n+  Tensor *t = unpackRetrieveTensor(raw_message);\n+  int k = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  r->diag(*t, k);\n+}\n+\n+static void tensorEye(rpc::RPCMessage& raw_message) {\n+  Tensor *tensor = unpackRetrieveTensor(raw_message);\n+  long n = unpackInteger(raw_message);\n+  long m = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  tensor->eye(n, m);\n+}\n+\n+static void tensorRange(rpc::RPCMessage& raw_message) {\n+  Tensor *r = unpackRetrieveTensor(raw_message);\n+  Type type = peekType(raw_message);\n+  if (isInteger(type)) {\n+    auto xmin = unpackInteger(raw_message);\n+    auto xmax = unpackInteger(raw_message);\n+    auto step = unpackInteger(raw_message);\n+    finalize(raw_message);\n+    dynamic_cast<IntTensor*>(r)->range(xmin, xmax, step);\n+  } else if (isFloat(type)) {\n+    auto xmin = unpackFloat(raw_message);\n+    auto xmax = unpackFloat(raw_message);\n+    auto step = unpackFloat(raw_message);\n+    finalize(raw_message);\n+    dynamic_cast<FloatTensor*>(r)->range(xmin, xmax, step);\n+  } else {\n+    throw std::runtime_error(\"expected a scalar type\");\n+  }\n+}\n+\n+static void tensorRandperm(rpc::RPCMessage& raw_message) {\n+  throw std::runtime_error(\"randperm is not available yet\");\n+}\n+\n+static void tensorSort(rpc::RPCMessage& raw_message) {\n+  Tensor *rt = unpackRetrieveTensor(raw_message);\n+  Tensor *ri = unpackRetrieveTensor(raw_message);\n+  Tensor *tensor = unpackRetrieveTensor(raw_message);\n+  int dimension = unpackInteger(raw_message);\n+  int desc = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  rt->sort(*ri, *tensor, dimension, desc);\n+}\n+\n+static void tensorTopk(rpc::RPCMessage& raw_message) {\n+  Tensor *rt = unpackRetrieveTensor(raw_message);\n+  Tensor *ri = unpackRetrieveTensor(raw_message);\n+  Tensor *tensor = unpackRetrieveTensor(raw_message);\n+  long k = unpackInteger(raw_message);\n+  int dimension = unpackInteger(raw_message);\n+  int dir = unpackInteger(raw_message);\n+  int sorted = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  rt->topk(*ri, *tensor, k, dimension, dir, sorted);\n+}\n+\n+static void tensorTril(rpc::RPCMessage& raw_message) {\n+  Tensor *r = unpackRetrieveTensor(raw_message);\n+  Tensor *t = unpackRetrieveTensor(raw_message);\n+  long k = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  r->tril(*t, k);\n+}\n+\n+static void tensorTriu(rpc::RPCMessage& raw_message) {\n+  Tensor *r = unpackRetrieveTensor(raw_message);\n+  Tensor *t = unpackRetrieveTensor(raw_message);\n+  long k = unpackInteger(raw_message);\n+  finalize(raw_message);\n+  r->triu(*t, k);\n+}\n+\n+static void tensorEqual(rpc::RPCMessage& raw_message) {\n+  Tensor *ta = unpackRetrieveTensor(raw_message);\n+  Tensor *tb = unpackRetrieveTensor(raw_message);\n+  finalize(raw_message);\n+  long long response = ta->equal(*tb);\n+  sendValueToMaster(response);\n+}\n+\n+#define TENSOR_IMPLEMENT_LOGICAL(NAME, METHODNAME)                   \\\n+  static void tensor##NAME##Value(rpc::RPCMessage& raw_message) {    \\\n+    Tensor *r = unpackRetrieveTensor(raw_message);                   \\\n+    Tensor *t = unpackRetrieveTensor(raw_message);                   \\\n+    if (isInteger(t->type())) {                                      \\\n+      long long value = unpackInteger(raw_message);                  \\\n+      finalize(raw_message);                                         \\\n+      dynamic_cast<IntTensor *>(t)->METHODNAME##Value(*r, value);    \\\n+    } else if (isFloat(t->type())) {                                 \\\n+      double value = unpackInteger(raw_message);                     \\\n+      finalize(raw_message);                                         \\\n+      dynamic_cast<FloatTensor *>(t)->METHODNAME##Value(*r, value);  \\\n+    } else {                                                         \\\n+      throw std::runtime_error(\"expected scalar type\");              \\\n+    }                                                                \\\n+  }                                                                  \\\n+  static void tensor##NAME##ValueT(rpc::RPCMessage& raw_message) {   \\\n+    Tensor *r = unpackRetrieveTensor(raw_message);                   \\\n+    Tensor *t = unpackRetrieveTensor(raw_message);                   \\\n+    if (isInteger(t->type())) {                                      \\\n+      long long value = unpackInteger(raw_message);                  \\\n+      finalize(raw_message);                                         \\\n+      dynamic_cast<IntTensor *>(r)->METHODNAME##Value(*t, value);    \\\n+    } else if (isFloat(t->type())) {                                 \\\n+      double value = unpackInteger(raw_message);                     \\\n+      finalize(raw_message);                                         \\\n+      dynamic_cast<FloatTensor *>(r)->METHODNAME##Value(*t, value);  \\\n+    } else {                                                         \\\n+      throw std::runtime_error(\"expected scalar type\");              \\\n+    }                                                                \\\n+  }                                                                  \\\n+  static void tensor##NAME##Tensor(rpc::RPCMessage& raw_message) {   \\\n+                                                                     \\\n+  }                                                                  \\\n+  static void tensor##NAME##TensorT(rpc::RPCMessage& raw_message) {  \\","path":"torch/lib/THD/master_worker/worker/dispatch/TensorMath.cpp","position":122,"original_position":122,"commit_id":"7437284fb3a6fca2d83b3cf77fa0c7e9fa191c09","original_commit_id":"7437284fb3a6fca2d83b3cf77fa0c7e9fa191c09","user":{"login":"VirrageS","id":3855799,"avatar_url":"https://avatars.githubusercontent.com/u/3855799?v=3","gravatar_id":"","url":"https://api.github.com/users/VirrageS","html_url":"https://github.com/VirrageS","followers_url":"https://api.github.com/users/VirrageS/followers","following_url":"https://api.github.com/users/VirrageS/following{/other_user}","gists_url":"https://api.github.com/users/VirrageS/gists{/gist_id}","starred_url":"https://api.github.com/users/VirrageS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VirrageS/subscriptions","organizations_url":"https://api.github.com/users/VirrageS/orgs","repos_url":"https://api.github.com/users/VirrageS/repos","events_url":"https://api.github.com/users/VirrageS/events{/privacy}","received_events_url":"https://api.github.com/users/VirrageS/received_events","type":"User","site_admin":false},"body":"As above","created_at":"2017-01-26T11:39:47Z","updated_at":"2017-01-26T11:45:51Z","html_url":"https://github.com/apaszke/pytorch-dist/pull/50#discussion_r97977036","pull_request_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/comments/97977036"},"html":{"href":"https://github.com/apaszke/pytorch-dist/pull/50#discussion_r97977036"},"pull_request":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50","id":101602633,"html_url":"https://github.com/apaszke/pytorch-dist/pull/50","diff_url":"https://github.com/apaszke/pytorch-dist/pull/50.diff","patch_url":"https://github.com/apaszke/pytorch-dist/pull/50.patch","issue_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/50","number":50,"state":"open","locked":false,"title":"[WIP] Implementation of tensor functions from set 3","user":{"login":"jytug","id":9921596,"avatar_url":"https://avatars.githubusercontent.com/u/9921596?v=3","gravatar_id":"","url":"https://api.github.com/users/jytug","html_url":"https://github.com/jytug","followers_url":"https://api.github.com/users/jytug/followers","following_url":"https://api.github.com/users/jytug/following{/other_user}","gists_url":"https://api.github.com/users/jytug/gists{/gist_id}","starred_url":"https://api.github.com/users/jytug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jytug/subscriptions","organizations_url":"https://api.github.com/users/jytug/orgs","repos_url":"https://api.github.com/users/jytug/repos","events_url":"https://api.github.com/users/jytug/events{/privacy}","received_events_url":"https://api.github.com/users/jytug/received_events","type":"User","site_admin":false},"body":"This PR is work in progress. I need to re-think the implementation of logical functions which return a `THDByteTensor` inside the workers, but aside from that, the PR is ready for review.\r\n\r\nI would appreciate it if you took a look at the `TODO`s I inserted in some of the files. Most of them are there for me to remember that I'm using functions that are not implemented yet, but some indicate that a certain piece of code I'm not entirely sure about","created_at":"2017-01-15T17:21:07Z","updated_at":"2017-01-26T11:45:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46073549e12c795baa24acd0a68b72194c260fe0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50/commits","review_comments_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50/comments","review_comment_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/50/comments","statuses_url":"https://api.github.com/repos/apaszke/pytorch-dist/statuses/7437284fb3a6fca2d83b3cf77fa0c7e9fa191c09","head":{"label":"apaszke:thd-functions-set3","ref":"thd-functions-set3","sha":"7437284fb3a6fca2d83b3cf77fa0c7e9fa191c09","user":{"login":"apaszke","id":4583066,"avatar_url":"https://avatars.githubusercontent.com/u/4583066?v=3","gravatar_id":"","url":"https://api.github.com/users/apaszke","html_url":"https://github.com/apaszke","followers_url":"https://api.github.com/users/apaszke/followers","following_url":"https://api.github.com/users/apaszke/following{/other_user}","gists_url":"https://api.github.com/users/apaszke/gists{/gist_id}","starred_url":"https://api.github.com/users/apaszke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apaszke/subscriptions","organizations_url":"https://api.github.com/users/apaszke/orgs","repos_url":"https://api.github.com/users/apaszke/repos","events_url":"https://api.github.com/users/apaszke/events{/privacy}","received_events_url":"https://api.github.com/users/apaszke/received_events","type":"User","site_admin":false},"repo":{"id":73211810,"name":"pytorch-dist","full_name":"apaszke/pytorch-dist","owner":{"login":"apaszke","id":4583066,"avatar_url":"https://avatars.githubusercontent.com/u/4583066?v=3","gravatar_id":"","url":"https://api.github.com/users/apaszke","html_url":"https://github.com/apaszke","followers_url":"https://api.github.com/users/apaszke/followers","following_url":"https://api.github.com/users/apaszke/following{/other_user}","gists_url":"https://api.github.com/users/apaszke/gists{/gist_id}","starred_url":"https://api.github.com/users/apaszke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apaszke/subscriptions","organizations_url":"https://api.github.com/users/apaszke/orgs","repos_url":"https://api.github.com/users/apaszke/repos","events_url":"https://api.github.com/users/apaszke/events{/privacy}","received_events_url":"https://api.github.com/users/apaszke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/apaszke/pytorch-dist","description":null,"fork":false,"url":"https://api.github.com/repos/apaszke/pytorch-dist","forks_url":"https://api.github.com/repos/apaszke/pytorch-dist/forks","keys_url":"https://api.github.com/repos/apaszke/pytorch-dist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apaszke/pytorch-dist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apaszke/pytorch-dist/teams","hooks_url":"https://api.github.com/repos/apaszke/pytorch-dist/hooks","issue_events_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/events{/number}","events_url":"https://api.github.com/repos/apaszke/pytorch-dist/events","assignees_url":"https://api.github.com/repos/apaszke/pytorch-dist/assignees{/user}","branches_url":"https://api.github.com/repos/apaszke/pytorch-dist/branches{/branch}","tags_url":"https://api.github.com/repos/apaszke/pytorch-dist/tags","blobs_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/refs{/sha}","trees_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apaszke/pytorch-dist/statuses/{sha}","languages_url":"https://api.github.com/repos/apaszke/pytorch-dist/languages","stargazers_url":"https://api.github.com/repos/apaszke/pytorch-dist/stargazers","contributors_url":"https://api.github.com/repos/apaszke/pytorch-dist/contributors","subscribers_url":"https://api.github.com/repos/apaszke/pytorch-dist/subscribers","subscription_url":"https://api.github.com/repos/apaszke/pytorch-dist/subscription","commits_url":"https://api.github.com/repos/apaszke/pytorch-dist/commits{/sha}","git_commits_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/commits{/sha}","comments_url":"https://api.github.com/repos/apaszke/pytorch-dist/comments{/number}","issue_comment_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/comments{/number}","contents_url":"https://api.github.com/repos/apaszke/pytorch-dist/contents/{+path}","compare_url":"https://api.github.com/repos/apaszke/pytorch-dist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apaszke/pytorch-dist/merges","archive_url":"https://api.github.com/repos/apaszke/pytorch-dist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apaszke/pytorch-dist/downloads","issues_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues{/number}","pulls_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls{/number}","milestones_url":"https://api.github.com/repos/apaszke/pytorch-dist/milestones{/number}","notifications_url":"https://api.github.com/repos/apaszke/pytorch-dist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apaszke/pytorch-dist/labels{/name}","releases_url":"https://api.github.com/repos/apaszke/pytorch-dist/releases{/id}","deployments_url":"https://api.github.com/repos/apaszke/pytorch-dist/deployments","created_at":"2016-11-08T17:47:52Z","updated_at":"2017-01-19T22:50:39Z","pushed_at":"2017-01-26T10:38:42Z","git_url":"git://github.com/apaszke/pytorch-dist.git","ssh_url":"git@github.com:apaszke/pytorch-dist.git","clone_url":"https://github.com/apaszke/pytorch-dist.git","svn_url":"https://github.com/apaszke/pytorch-dist","homepage":null,"size":8137,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":4,"default_branch":"thd"}},"base":{"label":"apaszke:thd","ref":"thd","sha":"12a22fb3d109d4a206db78b81a835b0c74059c4a","user":{"login":"apaszke","id":4583066,"avatar_url":"https://avatars.githubusercontent.com/u/4583066?v=3","gravatar_id":"","url":"https://api.github.com/users/apaszke","html_url":"https://github.com/apaszke","followers_url":"https://api.github.com/users/apaszke/followers","following_url":"https://api.github.com/users/apaszke/following{/other_user}","gists_url":"https://api.github.com/users/apaszke/gists{/gist_id}","starred_url":"https://api.github.com/users/apaszke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apaszke/subscriptions","organizations_url":"https://api.github.com/users/apaszke/orgs","repos_url":"https://api.github.com/users/apaszke/repos","events_url":"https://api.github.com/users/apaszke/events{/privacy}","received_events_url":"https://api.github.com/users/apaszke/received_events","type":"User","site_admin":false},"repo":{"id":73211810,"name":"pytorch-dist","full_name":"apaszke/pytorch-dist","owner":{"login":"apaszke","id":4583066,"avatar_url":"https://avatars.githubusercontent.com/u/4583066?v=3","gravatar_id":"","url":"https://api.github.com/users/apaszke","html_url":"https://github.com/apaszke","followers_url":"https://api.github.com/users/apaszke/followers","following_url":"https://api.github.com/users/apaszke/following{/other_user}","gists_url":"https://api.github.com/users/apaszke/gists{/gist_id}","starred_url":"https://api.github.com/users/apaszke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apaszke/subscriptions","organizations_url":"https://api.github.com/users/apaszke/orgs","repos_url":"https://api.github.com/users/apaszke/repos","events_url":"https://api.github.com/users/apaszke/events{/privacy}","received_events_url":"https://api.github.com/users/apaszke/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/apaszke/pytorch-dist","description":null,"fork":false,"url":"https://api.github.com/repos/apaszke/pytorch-dist","forks_url":"https://api.github.com/repos/apaszke/pytorch-dist/forks","keys_url":"https://api.github.com/repos/apaszke/pytorch-dist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apaszke/pytorch-dist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apaszke/pytorch-dist/teams","hooks_url":"https://api.github.com/repos/apaszke/pytorch-dist/hooks","issue_events_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/events{/number}","events_url":"https://api.github.com/repos/apaszke/pytorch-dist/events","assignees_url":"https://api.github.com/repos/apaszke/pytorch-dist/assignees{/user}","branches_url":"https://api.github.com/repos/apaszke/pytorch-dist/branches{/branch}","tags_url":"https://api.github.com/repos/apaszke/pytorch-dist/tags","blobs_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/refs{/sha}","trees_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apaszke/pytorch-dist/statuses/{sha}","languages_url":"https://api.github.com/repos/apaszke/pytorch-dist/languages","stargazers_url":"https://api.github.com/repos/apaszke/pytorch-dist/stargazers","contributors_url":"https://api.github.com/repos/apaszke/pytorch-dist/contributors","subscribers_url":"https://api.github.com/repos/apaszke/pytorch-dist/subscribers","subscription_url":"https://api.github.com/repos/apaszke/pytorch-dist/subscription","commits_url":"https://api.github.com/repos/apaszke/pytorch-dist/commits{/sha}","git_commits_url":"https://api.github.com/repos/apaszke/pytorch-dist/git/commits{/sha}","comments_url":"https://api.github.com/repos/apaszke/pytorch-dist/comments{/number}","issue_comment_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues/comments{/number}","contents_url":"https://api.github.com/repos/apaszke/pytorch-dist/contents/{+path}","compare_url":"https://api.github.com/repos/apaszke/pytorch-dist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apaszke/pytorch-dist/merges","archive_url":"https://api.github.com/repos/apaszke/pytorch-dist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apaszke/pytorch-dist/downloads","issues_url":"https://api.github.com/repos/apaszke/pytorch-dist/issues{/number}","pulls_url":"https://api.github.com/repos/apaszke/pytorch-dist/pulls{/number}","milestones_url":"https://api.github.com/repos/apaszke/pytorch-dist/milestones{/number}","notifications_url":"https://api.github.com/repos/apaszke/pytorch-dist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apaszke/pytorch-dist/labels{/name}","releases_url":"https://api.github.com/repos/apaszke/pytorch-dist/releases{/id}","deployments_url":"https://api.github.com/repos/apaszke/pytorch-dist/deployments","created_at":"2016-11-08T17:47:52Z","updated_at":"2017-01-19T22:50:39Z","pushed_at":"2017-01-26T10:38:42Z","git_url":"git://github.com/apaszke/pytorch-dist.git","ssh_url":"git@github.com:apaszke/pytorch-dist.git","clone_url":"https://github.com/apaszke/pytorch-dist.git","svn_url":"https://github.com/apaszke/pytorch-dist","homepage":null,"size":8137,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":4,"default_branch":"thd"}},"_links":{"self":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50"},"html":{"href":"https://github.com/apaszke/pytorch-dist/pull/50"},"issue":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/issues/50"},"comments":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/apaszke/pytorch-dist/statuses/7437284fb3a6fca2d83b3cf77fa0c7e9fa191c09"}}}}
{"actor":{"display_login":"VirrageS"}}