Skip to content

Commit

Permalink
Switch layer still on wrong device
Browse files Browse the repository at this point in the history
  • Loading branch information
jloveric committed Apr 25, 2023
1 parent a9a5194 commit b9dc68f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions neural_network_pdes/euler_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def forward(self, x: Tensor) -> Tensor:
class Net(LightningModule):
def __init__(self, cfg: DictConfig):
super().__init__()
device = "gpu" if cfg.accelerator is "cuda" else "cpu"

self.automatic_optimization = False

self.save_hyperparameters(cfg)
Expand Down Expand Up @@ -95,6 +97,7 @@ def __init__(self, cfg: DictConfig):
periodicity=cfg.mlp.periodicity,
rotations=cfg.mlp.rotations,
resnet=cfg.mlp.resnet,
device=device,
)
elif cfg.mlp.style == "high-order-input":
layer_list = []
Expand All @@ -104,6 +107,7 @@ def __init__(self, cfg: DictConfig):
in_features=cfg.mlp.input.width,
out_features=cfg.mlp.hidden.width,
segments=cfg.mlp.input.segments,
device=device,
)
layer_list.append(input_layer)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hydra-nevergrad-sweeper = "1.3.0.dev0"
omegaconf = "^2.2.3"
Pillow = "^9.3.0"
torch-optimizer = "^0.3.0"
#high-order-layers-optimizers = { git = "https://github.com/jloveric/adahessian.git", branch = "master" }
high-order-layers-optimizers = { git = "https://github.com/jloveric/adahessian.git", branch = "master" }
grpcio = "1.51.1"
high-order-layers-torch = "^2.0.0"

Expand Down

0 comments on commit b9dc68f

Please sign in to comment.