Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strided_copy的size是不是应该跟out的size有关?如果in的size大于out的size,他是有多个输入写到同一个输出地址吗?overwrite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的data_size是指原始的数据大小,即显存里实际存放的大小,不是逻辑上的tensor大小,输入输出的data_size由于stride的存在都有可能远大于tensor.numel(),是否overwrite由stride和shape共同控制,合法的strided_copy不应该存在overwrite的情形。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
理论上是不是不需要data_size这个参数?tensor的dim和stride可以推算出来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上这个参数 1 是为了做合法校验,防止paddle的bug,api参数检查会通过tensor的dim和stride计算tensor大小,不能大于data_size 2 对于API来说是必要的,因为单测要分配原始tensor大小的显存,需要预先定好