MCPcopy Create free account
hub / github.com/apple/axlearn / config_for_function

Function config_for_function

axlearn/common/config.py:1082–1098  ·  view source on GitHub ↗

Returns an instance of FunctionConfigBase, which invokes `fn` upon instantiation. Example: ``` cfg = config_for_function(pow).set(exp=2) assert cfg.set(base=3).instantiate() == 9 ``` Args: fn: The function to wrap. Returns: A Config that

(fn: Callable[..., T])

Source from the content-addressed store, hash-verified

1080
1081
1082def config_for_function(fn: Callable[..., T]) -> Union[Any, FunctionConfigBase[T]]:
1083 """Returns an instance of FunctionConfigBase, which invokes `fn` upon instantiation.
1084
1085 Example:
1086 ```
1087 cfg = config_for_function(pow).set(exp=2)
1088 assert cfg.set(base=3).instantiate() == 9
1089 ```
1090
1091 Args:
1092 fn: The function to wrap.
1093
1094 Returns:
1095 A Config that when instantiated, invokes `fn` based on any config fields that have been set.
1096 """
1097 config_cls = _config_class_for_function(fn)
1098 return config_cls(fn=fn)
1099
1100
1101@config_class

Callers 15

named_runner_configsFunction · 0.90
_mock_configFunction · 0.90
test_submitMethod · 0.90
launch.pyFile · 0.90
__init__Method · 0.90
_dummy_reporter_as_cfgFunction · 0.90
test_initMethod · 0.90
test_leftoverMethod · 0.90
sweepMethod · 0.90
test_sweepMethod · 0.90

Calls 1

Tested by 15

_mock_configFunction · 0.72
test_submitMethod · 0.72
_dummy_reporter_as_cfgFunction · 0.72
test_initMethod · 0.72
test_leftoverMethod · 0.72
test_sweepMethod · 0.72
_patch_bastionMethod · 0.72
test_uploadMethod · 0.72
config_genMethod · 0.72