Skip to content

Commit

Permalink
warn
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Jun 12, 2024
1 parent 7aab74e commit 949d060
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions benchmarl/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

import pathlib

import warnings
from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass
from typing import Any, Callable, Dict, List, Optional, Sequence
Expand Down Expand Up @@ -165,7 +165,10 @@ def share_params_with(self, other_model):
or self.input_spec != other_model.input_spec
or self.output_spec != other_model.output_spec
):
raise ValueError("Can only share params between identical models.")
raise warnings.warn(
"Sharing parameters with models that are not identical. "
"This might result in unintended behavior or error."
)
for param, other_param in zip(self.parameters(), other_model.parameters()):
other_param.data[:] = param.data

Expand Down

0 comments on commit 949d060

Please sign in to comment.