Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix actnn tests #263

Merged
merged 2 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cogdl/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def build_args_from_dict(dic):
return args


def update_args_from_dict(args, dic):
for key, value in dic.items():
args.__setattr__(key, value)
return args


def set_random_seed(seed):
random.seed(seed)
np.random.seed(seed)
Expand Down
1 change: 1 addition & 0 deletions tests/models/ssl/test_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def get_default_args():
"eval_agc": False,
"subgraph_sampling": False,
"sample_size": 128,
"actnn": False,
}
args = build_args_from_dict(args)
dataset = build_dataset(args)
Expand Down
9 changes: 5 additions & 4 deletions tests/tasks/test_link_prediction.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import torch

from torch import argsort
from cogdl import options
from cogdl.tasks import build_task, register_task
from cogdl.tasks import build_task
from cogdl.datasets import build_dataset
from cogdl.models import build_model
from cogdl.utils import build_args_from_dict


Expand All @@ -21,6 +18,7 @@ def get_default_args():
"activation": "relu",
"residual": False,
"norm": None,
"actnn": False,
}
return build_args_from_dict(default_dict)

Expand Down Expand Up @@ -59,6 +57,7 @@ def get_kg_default_args():
"activation": "relu",
"residual": False,
"norm": None,
"actnn": False,
}
return build_args_from_dict(default_dict)

Expand Down Expand Up @@ -129,6 +128,7 @@ def get_kge_default_args():
"checkpoint": False,
"save_dir": ".",
"device_id": [0],
"actnn": False,
}
return build_args_from_dict(default_dict)

Expand Down Expand Up @@ -193,6 +193,7 @@ def get_gnn_link_prediction_args():
"activation": "relu",
"residual": False,
"norm": None,
"actnn": False,
}
return build_args_from_dict(args)

Expand Down
Loading