[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Motivation and Context / Related issue
In the current implementation, create_one_dim_tr_model identifies the BasicEnsemble class through the attribute _target_ of cfg.dynamics_model, and this process relies entirely on string comparison. This prevents developers from inheriting the BasicEnsemble class to achieve the specific functions they need. We should judge whether the class corresponding to _target_ is a subclass of BasicEnsemble rather than just compare the string. The corresponding issue is #182.
How Has This Been Tested (if it applies)
In tests/core/test_common_utils.py, add class CustomEnsemble inheriting BasicEnsemble and and create it using create_one_dim_tr_model. Check the correction of dynamics_model.model.in_size and dynamics_model.model.out_size then.
Checklist
[x] The documentation is up-to-date with the changes I made.
[x] I have read the CONTRIBUTING document and completed the CLA (see CONTRIBUTING).
[x] All tests passed, and additional code has been covered with new tests.
Types of changes
Motivation and Context / Related issue
In the current implementation,
create_one_dim_tr_model
identifies theBasicEnsemble
class through the attribute_target_
ofcfg.dynamics_model
, and this process relies entirely on string comparison. This prevents developers from inheriting theBasicEnsemble
class to achieve the specific functions they need. We should judge whether the class corresponding to_target_
is a subclass ofBasicEnsemble
rather than just compare the string. The corresponding issue is #182.How Has This Been Tested (if it applies)
In
tests/core/test_common_utils.py
, add classCustomEnsemble
inheritingBasicEnsemble
and and create it usingcreate_one_dim_tr_model
. Check the correction ofdynamics_model.model.in_size
anddynamics_model.model.out_size
then.Checklist