Skip to content

A potential overflow problem in Dim #3889

@JiayiFeng

Description

@JiayiFeng

In the current code, elements of DDim are int(32 bit) values. This design is directly ported from Majel. However, product() returns a ssize_t(64 bit) value. It's necessary because the product result of a huge tensor's dimensions can be extremly large (e.g. in word embedding). When we flatten a tensor to a vector, we are trying to assign a ssize_t value to an int value. It may cause overflow.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions