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

Method astype

python/dgl/heterograph.py:6241–6264  ·  view source on GitHub ↗

Cast this graph to use another ID type. Features are copied (shallow copy) to the new graph. Parameters ---------- idtype : Data type object. New ID type. Can only be int32 or int64. Returns ------- DGLGraph Graph in

(self, idtype)

Source from the content-addressed store, hash-verified

6239 return self._graph.create_formats_()
6240
6241 def astype(self, idtype):
6242 """Cast this graph to use another ID type.
6243
6244 Features are copied (shallow copy) to the new graph.
6245
6246 Parameters
6247 ----------
6248 idtype : Data type object.
6249 New ID type. Can only be int32 or int64.
6250
6251 Returns
6252 -------
6253 DGLGraph
6254 Graph in the new ID type.
6255 """
6256 if idtype is None:
6257 return self
6258 utils.check_valid_idtype(idtype)
6259 if self.idtype == idtype:
6260 return self
6261 bits = 32 if idtype == F.int32 else 64
6262 ret = copy.copy(self)
6263 ret._graph = self._graph.asbits(bits)
6264 return ret
6265
6266 # TODO: Formats should not be specified, just saving all the materialized formats
6267 def shared_memory(self, name, formats=("coo", "csr", "csc")):

Callers 6

longMethod · 0.95
intMethod · 0.95
remove_edgesMethod · 0.45
remove_nodesMethod · 0.45
has_nodesMethod · 0.45
has_edges_betweenMethod · 0.45

Calls 1

asbitsMethod · 0.45

Tested by

no test coverage detected