pytorch
688a9dbe - Move type casting to c10/util/TypeCast.h (#28426)

Commit
5 years ago
Move type casting to c10/util/TypeCast.h (#28426) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28426 Type casting is used in copy, and will be used also in tensor iterator in the next stacked diff. I move it to c10 to make it serve as an common util for different things. I also add two dynamic casting functions - fetch_and_cast - cast_and_store fetch_and_cast fetch a value with dynamic type specified by a ScalarType from a void pointer and cast it to a static type. cast_and_store casts a static typed value into dynamic type specified by a ScalarType, and store it into a void pointer. Test Plan: Imported from OSS Differential Revision: D18170996 Pulled By: ezyang fbshipit-source-id: 41658afd5c0ab58c6b6c510424893d9a2a0c059e
Author
Parents
Loading