Glow: deduplicateConstants assert will always fire if Constant contains NaN

Created on 30 Jul 2019  路  5Comments  路  Source: pytorch/glow

The assert referenced below will always assert for Constants that contain a NaN since such constants will always return false from isEqual. Furthermore, Constants that contain NaN will not be de-duplicated for this same reason. Perhaps it would be better to avoid using isEqual in ConstsEqDedup and instead do a bit-wise comparison.

This assert fires intermittently in the test GraphOptz.ReshapeConstantOneUse depending on whether the uninitialized input tensor contains a NaN.

https://github.com/pytorch/glow/blob/25ce2de7248d7be1e8e43ded9b36d5e3ce0e7cb2/lib/Optimizer/GraphOptimizer/GraphOptimizer.cpp#L1818

Most helpful comment

I'm going to start working on a patch shortly.

All 5 comments

Thanks for reporting this issue @geoffberry! Are you interested in putting up a fix for this?

Nice catch! I kind of think that assert is problematic; iirc a vanilla std::map<float> will fail to find NAN keys too. Idk if it鈥檚 worth adding special logic to dedup constants with NAN but I鈥檓 kind of ok either way.

I'm going to start working on a patch shortly.

Thanks @chadrosier!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dati91 picture dati91  路  3Comments

pjaaskel picture pjaaskel  路  4Comments

gcatron picture gcatron  路  4Comments

mciprian13 picture mciprian13  路  4Comments

speryt picture speryt  路  3Comments