MCPcopy
hub / github.com/dmlc/dgl / to_float

Function to_float

python/dgl/transforms/functional.py:3765–3780  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

3763
3764
3765def 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
3783def to_double(g):

Callers

nothing calls this directly

Calls 1

floatMethod · 0.45

Tested by

no test coverage detected