"examples/vscode:/vscode.git/clone" did not exist on "6f15026330849187027854ec64c5adc1e238dcb8"
Unverified Commit a208e886 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Misc] Black auto fix. (#4680)



* [Misc] Black auto fix.

* fix pylint disable
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 29434e65
This diff is collapsed.
import argparse import argparse
import os
import json import json
import os
def set_default_backend(default_dir, backend_name): def set_default_backend(default_dir, backend_name):
os.makedirs(default_dir, exist_ok=True) os.makedirs(default_dir, exist_ok=True)
config_path = os.path.join(default_dir, 'config.json') config_path = os.path.join(default_dir, "config.json")
with open(config_path, "w") as config_file: with open(config_path, "w") as config_file:
json.dump({'backend': backend_name.lower()}, config_file) json.dump({"backend": backend_name.lower()}, config_file)
print('Setting the default backend to "{}". You can change it in the ' print(
'~/.dgl/config.json file or export the DGLBACKEND environment variable. ' 'Setting the default backend to "{}". You can change it in the '
'Valid options are: pytorch, mxnet, tensorflow (all lowercase)'.format( "~/.dgl/config.json file or export the DGLBACKEND environment variable. "
backend_name)) "Valid options are: pytorch, mxnet, tensorflow (all lowercase)".format(
backend_name
)
)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("default_dir", type=str, default=os.path.join(os.path.expanduser('~'), '.dgl')) parser.add_argument(
parser.add_argument("backend", nargs=1, type=str, choices=[ "default_dir",
'pytorch', 'tensorflow', 'mxnet'], help="Set default backend") type=str,
default=os.path.join(os.path.expanduser("~"), ".dgl"),
)
parser.add_argument(
"backend",
nargs=1,
type=str,
choices=["pytorch", "tensorflow", "mxnet"],
help="Set default backend",
)
args = parser.parse_args() args = parser.parse_args()
set_default_backend(args.default_dir, args.backend[0]) set_default_backend(args.default_dir, args.backend[0])
import os import os
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
from .tensor import * os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"
from .sparse import * from .sparse import *
from .tensor import *
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment