r"""Cast this graph to use float32 (single-precision) for any floating-point edge and node feature data. A shallow copy is returned so that the original graph is not modified. Feature tensors that are not floating-point will not be modified. Returns ------- DGLGraph
(g)
| 3763 | |
| 3764 | |
| 3765 | def to_float(g): |
| 3766 | r"""Cast this graph to use float32 (single-precision) for any |
| 3767 | floating-point edge and node feature data. |
| 3768 | |
| 3769 | A shallow copy is returned so that the original graph is not modified. |
| 3770 | Feature tensors that are not floating-point will not be modified. |
| 3771 | |
| 3772 | Returns |
| 3773 | ------- |
| 3774 | DGLGraph |
| 3775 | Clone of graph with the feature data converted to float32. |
| 3776 | """ |
| 3777 | ret = copy.copy(g) |
| 3778 | ret._edge_frames = [frame.float() for frame in ret._edge_frames] |
| 3779 | ret._node_frames = [frame.float() for frame in ret._node_frames] |
| 3780 | return ret |
| 3781 | |
| 3782 | |
| 3783 | def to_double(g): |