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

Function set_default_backend

python/dgl/backend/set_default_backend.py:6–17  ·  view source on GitHub ↗
(default_dir, backend_name)

Source from the content-addressed store, hash-verified

4
5
6def set_default_backend(default_dir, backend_name):
7 os.makedirs(default_dir, exist_ok=True)
8 config_path = os.path.join(default_dir, "config.json")
9 with open(config_path, "w") as config_file:
10 json.dump({"backend": backend_name.lower()}, config_file)
11 print(
12 'Setting the default backend to "{}". You can change it in the '
13 "~/.dgl/config.json file or export the DGLBACKEND environment variable. "
14 "Valid options are: pytorch, mxnet, tensorflow (all lowercase)".format(
15 backend_name
16 )
17 )
18
19
20if __name__ == "__main__":

Callers 2

get_preferred_backendFunction · 0.90

Calls 3

dumpMethod · 0.80
formatMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected