[Feature] Added floating-point conversion functions to dgl.transforms.functional (#3890)
* * Added half_(), float_(), and double_() functions to DGLHeteroGraph, HeteroNodeDataView, and HeteroEdgeDataView, for converting floating-point tensor data to float16, float32, or float64 precision
* * Extracted out private functions for floating-point type conversion, to reduce code duplication
* * Added test for floating-point data conversion functions, half_(), float_(), and double_()
* * Moved half_(), float_(), and double_() functions from HeteroNodeDataView and HeteroEdgeDataView to Frame class
* * Updated test_float_cast() to use dgl.heterograph instead of dgl.graph
* Added to CONTRIBUTORS.md
* * Changed data type conversion to be deferred until the data is accessed, to avoid redundant conversions of data that isn't used.
* * Addressed issues flagged by linter
* * Worked around a bug in the old version of mxnet that's currently used for DGL testing
* * Only defer Column data type conversion if there is a pending device transfer or index sampling to be done. This is expected to be the desired behaviour based on discussions of a few use cases, as described in the comments.
* * Moved floating-point feature data conversion functions to dgl.transforms.functional
* Changed them from in-place behaviour to shallow copy (out-of-place) behaviour
* * Fixed linter issues
* * Removed lines that unintentionally added to_half, to_float, and to_double to DGLHeteroGraph
* Moved _init_api line to the end of the file again
* * Removed one of the two leading underscores from Frame.__astype_float, making it not fully private
Co-authored-by:
nv-dlasalle <63612878+nv-dlasalle@users.noreply.github.com>
Showing
Please register or sign in to comment