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 20:47:48 UTC

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

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