MCPcopy
hub / github.com/PaddlePaddle/PaddleRec / numpy

Method numpy

models/rank/sign/graph.py:412–445  ·  view source on GitHub ↗

Convert the Graph into numpy format. In numpy format, the graph edges and node features are in numpy.ndarray format. But you can't use send and recv in numpy graph. Args: inplace: (Default True) Whether to convert the graph into numpy inplace.

(self, inplace=True)

Source from the content-addressed store, hash-verified

410 return value
411
412 def numpy(self, inplace=True):
413 """Convert the Graph into numpy format.
414
415 In numpy format, the graph edges and node features are in numpy.ndarray format.
416 But you can't use send and recv in numpy graph.
417
418 Args:
419
420 inplace: (Default True) Whether to convert the graph into numpy inplace.
421
422 """
423 if not self._is_tensor:
424 return self
425
426 if inplace:
427 for key in self.__dict__:
428 self.__dict__[key] = self._apply_to_numpy(
429 key, self.__dict__[key], inplace)
430 return self
431 else:
432 new_dict = {}
433 for key in self.__dict__:
434 new_dict[key] = self._apply_to_numpy(key, self.__dict__[key],
435 inplace)
436
437 graph = self.__class__(
438 num_nodes=new_dict["_num_nodes"],
439 edges=new_dict["_edges"],
440 node_feat=new_dict["_node_feat"],
441 edge_feat=new_dict["_edge_feat"],
442 adj_src_index=new_dict["_adj_src_index"],
443 adj_dst_index=new_dict["_adj_dst_index"],
444 **new_dict)
445 return graph
446
447 def dump(self, path):
448 """Dump the graph into a directory.

Callers 15

dumpMethod · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
run_rpc_clientFunction · 0.80
run_web_clientFunction · 0.80
_bytes_featureFunction · 0.80
line_processMethod · 0.80
_bytes_featureFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 1

_apply_to_numpyMethod · 0.95

Tested by

no test coverage detected