{"action":"closed","issue":{"url":"https://api.github.com/repos/dmlc/mxnet/issues/3594","repository_url":"https://api.github.com/repos/dmlc/mxnet","labels_url":"https://api.github.com/repos/dmlc/mxnet/issues/3594/labels{/name}","comments_url":"https://api.github.com/repos/dmlc/mxnet/issues/3594/comments","events_url":"https://api.github.com/repos/dmlc/mxnet/issues/3594/events","html_url":"https://github.com/dmlc/mxnet/issues/3594","id":184663975,"number":3594,"title":"How to directly access Tensor element in a c++ gpu Operator?","user":{"login":"dianyancao","id":8494704,"avatar_url":"https://avatars.githubusercontent.com/u/8494704?v=3","gravatar_id":"","url":"https://api.github.com/users/dianyancao","html_url":"https://github.com/dianyancao","followers_url":"https://api.github.com/users/dianyancao/followers","following_url":"https://api.github.com/users/dianyancao/following{/other_user}","gists_url":"https://api.github.com/users/dianyancao/gists{/gist_id}","starred_url":"https://api.github.com/users/dianyancao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dianyancao/subscriptions","organizations_url":"https://api.github.com/users/dianyancao/orgs","repos_url":"https://api.github.com/users/dianyancao/repos","events_url":"https://api.github.com/users/dianyancao/events{/privacy}","received_events_url":"https://api.github.com/users/dianyancao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-23T00:41:26Z","updated_at":"2016-10-25T13:17:42Z","closed_at":"2016-10-25T13:17:42Z","body":"I try to access Tensor element in Forward function in my new c++ gpu Operator,but got violation access error.\r\nFollowing is code snippet:\r\n```\r\n...\r\nauto scale_data = out_data[CTCLoss_enum::k_scale_data].get<xpu, 4, DType>(s);\r\nauto max_prob = out_data[CTCLoss_enum::k_max_prob].get<xpu, 3, DType>(s);\r\nDType epsilon = 1.0 / std::sqrt(std::numeric_limits<float_t>::max());\r\n...\r\nfor (int n = 0; n < scale_data.size(0); ++n)\r\n{\r\n\tfor (int y = 0; y < scale_data.size(2); ++y)\r\n\t{\r\n\t\tfor (int x = 0; x < scale_data.size(3); ++x)\r\n\t\t{\r\n\t\t\tmax_prob[n][y][x] = epsilon;// this will cause violation access error\r\n\t\t\t...\r\n\t\t}\r\n\t}\r\n}\r\n```\r\nI am new to cuda programming.In this case,I prefer to access Tensor element directly,shoud I write a new mshadow_op to do this?\r\nThe code runs well in cpu mode."}}
{"actor":{"display_login":"dianyancao"}}