File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ def __init__(self, **kwargs):
3434 """
3535 super ().__init__ ()
3636 self .data = self .store_data (** kwargs )
37+ self .has_custom_dataloader_fn = False
3738
3839 @property
3940 def problem (self ):
@@ -131,3 +132,17 @@ def create_dataloader(
131132 batch_size = batch_size ,
132133 ** kwargs ,
133134 )
135+
136+ def switch_dataloader_fn (self , create_dataloader_fn ):
137+ """
138+ Decorator to switch the dataloader function for a condition.
139+
140+ :param create_dataloader_fn: The new dataloader function to use.
141+ :type create_dataloader_fn: function
142+ :return: The decorated function with the new dataloader function.
143+ :rtype: function
144+ """
145+ # Replace the create_dataloader method of the ConditionBase class with
146+ # the new function
147+ self .has_custom_dataloader_fn = True
148+ self .create_dataloader = create_dataloader_fn
You can’t perform that action at this time.
0 commit comments