graphgallery¶
-
is_listlike(x: Any) → bool[source]¶ Check whether
xis list like, e.g., Tuple, List, or Numpy object.Parameters: x (A python object to check.) – Returns: Return type: Trueiffxis a list like sequence.
-
is_multiobjects(x: Any) → bool[source]¶ Check whether
xis a list of complex objects (not integers).Parameters: x (A python object to check.) – Returns: Return type: Trueiffxis a list of complex objects.
-
is_scalar(x: Any) → bool[source]¶ Check whether
xis a scalar, an array scalar, or a 0-dim array.Parameters: x (A python object to check.) – Returns: Return type: Trueiffxis a scalar, an array scalar, or a 0-dim array.
-
is_intscalar(x: Any) → bool[source]¶ Check whether
xis an integer scalar.Parameters: x (A python object to check.) – Returns: Return type: Trueiffxis an integer scalar (built-in or Numpy integer).
-
is_floatscalar(x: Any) → bool[source]¶ Check whether
xis a float scalar.Parameters: x (A python object to check.) – Returns: Return type: Trueiffxis a float scalar (built-in or Numpy float).
-
backend(module_name=None)[source]¶ Publicly accessible method for determining the current backend.
- module_name: String or ‘BackendModule’, optional.
- ‘torch’, PyTorchBackend, ‘pyg, etc. if not specified, return the current default backend module.
The backend module.
E.g. ‘PyTorch 1.6.0+cpu Backend’.
>>> graphgallery.backend() 'PyTorch 1.6.0+cpu Backend'
-
set_backend(module_name=None)[source]¶ Set the default backend module.
- module_name: String or ‘BackendModule’, optional.
- ‘th’, ‘torch’, ‘pytorch’.
>>> graphgallery.backend() 'PyTorch 1.6.0+cpu Backend'
ValueError: In case of invalid value.
-
file_ext()[source]¶ Returns the checkpoint filename suffix(extension) for the training model
Returns: “.pth” by default Return type: str
-
class
BackendModule(module=None)[source]¶ Base Backend Module Class.
-
alias= {}¶
-
version¶
-
name¶
-
abbr¶
-
-
class
PyTorchBackend(module='torch')[source]¶ -
alias= {'pytorch', 'th', 'torch'}¶
-
version¶
-
name¶
-
abbr¶
-
-
class
CfgNode(init_dict=None, key_list=None, new_allowed=False)[source]¶ Our own extended version of
yacs.config.CfgNode. It contains the following extra features:- The
merge_from_file()method supports the “_BASE_” key, which allows the new CfgNode to inherit all the attributes from the base configuration file. - Keys that start with “COMPUTED_” are treated as insertion-only “computed” attributes. They can be inserted regardless of whether the CfgNode is frozen or not.
- With “allow_unsafe=True”, it supports pyyaml tags that evaluate expressions in config. See examples in https://pyyaml.org/wiki/PyYAMLDocumentation#yaml-tags-and-python-types Note that this may lead to arbitrary code execution: you must not load a config file from untrusted sources before manually inspecting the content of the file.
-
classmethod
load_yaml_with_base(filename: str, allow_unsafe: bool = False) → None[source]¶ - Just like yaml.load(open(filename)), but inherit attributes from its
- _BASE_.
Parameters: Returns: the loaded yaml
Return type: (dict)
-
merge_from_file(cfg_filename: str, allow_unsafe: bool = False) → None[source]¶ Merge configs from a given yaml file.
Parameters: - cfg_filename – the file name of the yaml config.
- allow_unsafe – whether to allow loading the config file with yaml.unsafe_load.
-
merge_from_other_cfg(cfg_other: object) → Callable[[], None][source]¶ Parameters: cfg_other (CfgNode) – configs to merge from.
- The