Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
retinfai committed Oct 31, 2023
1 parent 322c09b commit 7a3fe8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cares_reinforcement_learning/util/NetworkFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ def create_network(self, observation_size, action_num, config: AlgorithmConfig):
https://stackoverflow.com/questions/1796180/how-can-i-get-a-list-of-all-classes-within-current-module-in-python
'''

agent = None

for name, obj in inspect.getmembers(sys.modules[__name__]):
if inspect.isfunction(obj):
if name == f"create_{algorithm}":
return obj(observation_size, action_num, config)
agent = obj(observation_size, action_num, config)

raise Exception(f"CARES RL NetworkFactory: {algorithm} is not implemented ")
if agent is None:
logging.warn(f"Unkown failed to return None: returned {agent}")

return agent

0 comments on commit 7a3fe8a

Please sign in to comment.