Skip to content

Commit

Permalink
Merge pull request #216 from icecube/fix212
Browse files Browse the repository at this point in the history
Implement fall back to ParameterGrid if no objects were specified and sequence/instance check.
  • Loading branch information
tomaskontrimas authored Feb 20, 2024
2 parents 9070370 + 66d1c6f commit cad1a64
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion skyllh/core/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,9 +1545,19 @@ def __init__(
The ParameterGrid instances this instance of ParameterGridSet should
get initialized with.
"""
# Infer `obj_type` from the `param_grids` argument.
if issequence(param_grids):
obj_type = type(param_grids[0])
else:
obj_type = type(param_grids)

if obj_type is type(None):
# Fall back to the default `ParameterGrid` type.
obj_type = ParameterGrid

super().__init__(
objs=param_grids,
obj_type=type(param_grids[0]),
obj_type=obj_type,
**kwargs)

@property
Expand Down

0 comments on commit cad1a64

Please sign in to comment.