nvflare.fuel.utils.experimental module¶
- experimental(reason)[source]¶
This is a decorator which can be used to mark classes and functions as experimental. It will result in a warning being emitted when the class is used.
# Example of usage:
- # Example 1: Use with class inheritance
@experimental(“Because it’s experimental”) class ExperimentalBaseClass:
- def __init__(self):
print(“Creating an instance of ExperimentalBaseClass”)
@experimental(“Derived from experimental class”) class ExperimentalClass(ExperimentalBaseClass):
- def __init__(self):
ExperimentalBaseClass.__init__(self) print(“Creating an instance of ExperimentalClass”)
# Testing the experimental class experimental_instance = ExperimentalClass() # This should emit two experimental warnings for base and derived class.
- # Example 2: Use with functions
@experimental(“Experimental function”) def test_f(a, b):
print(f”hello {a} and {b}”)
# Testing the experimental function test_f(“Adam”, “Eve”) # This should emit an experimental warning for use of the function.