You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/05/24 17:21:42 UTC

[GitHub] [tvm] tkonolige opened a new pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

tkonolige opened a new pull request #8120:
URL: https://github.com/apache/tvm/pull/8120


   I've also improved the error handling.
   
   @jroesch @masahi @tqchen 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tqchen commented on a change in pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

Posted by GitBox <gi...@apache.org>.
tqchen commented on a change in pull request #8120:
URL: https://github.com/apache/tvm/pull/8120#discussion_r638261079



##########
File path: src/parser/parser.cc
##########
@@ -524,12 +524,12 @@ class Parser {
   NDArray NumberToNDArray(const Token& token) {
     if (token->token_type == TokenType::kInteger) {
       DLDevice dev = {DLDeviceType::kDLCPU, 0};
-      auto dtype = String2DLDataType("int32");
+      auto dtype = String2DLDataType("int64");
       auto data = NDArray::Empty({}, dtype, dev);
-      auto array = reinterpret_cast<int32_t*>(data->data);
+      auto array = reinterpret_cast<int64_t*>(data->data);
       // revisit this, literal node issue.
       int64_t value = Downcast<tvm::Integer>(token->data);
-      array[0] = (int32_t)value;
+      array[0] = (int64_t)value;

Review comment:
       `static_cast<int64_t>`(always prefer c++ style cast)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

Posted by GitBox <gi...@apache.org>.
tkonolige commented on pull request #8120:
URL: https://github.com/apache/tvm/pull/8120#issuecomment-856088774


   @tqchen @altanh Can we merge?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] altanh commented on a change in pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

Posted by GitBox <gi...@apache.org>.
altanh commented on a change in pull request #8120:
URL: https://github.com/apache/tvm/pull/8120#discussion_r638264357



##########
File path: src/parser/parser.cc
##########
@@ -524,12 +524,12 @@ class Parser {
   NDArray NumberToNDArray(const Token& token) {
     if (token->token_type == TokenType::kInteger) {
       DLDevice dev = {DLDeviceType::kDLCPU, 0};
-      auto dtype = String2DLDataType("int32");
+      auto dtype = String2DLDataType("int64");
       auto data = NDArray::Empty({}, dtype, dev);
-      auto array = reinterpret_cast<int32_t*>(data->data);
+      auto array = reinterpret_cast<int64_t*>(data->data);
       // revisit this, literal node issue.
       int64_t value = Downcast<tvm::Integer>(token->data);
-      array[0] = (int32_t)value;
+      array[0] = (int64_t)value;

Review comment:
       it looks like we don't even need this particular cast now




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tqchen commented on pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

Posted by GitBox <gi...@apache.org>.
tqchen commented on pull request #8120:
URL: https://github.com/apache/tvm/pull/8120#issuecomment-847236739


   thanks @tkonolige perhaps we can introduce a regression testcase(e.g. parse a long int) ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] tqchen merged pull request #8120: [FIX] Allow tokenizer to parse numbers greater than INT_MAX.

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #8120:
URL: https://github.com/apache/tvm/pull/8120


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org