class relax.docs.CustomizedMarkdownRenderer(sym, name=None, title_level=3)
Displaying documents of functions, classes, haiku.module, and BaseParser.
CustomizedMarkdownRenderer is the customized markdown render for the ReLax documentation site. We can use it to displaying documents of functions, classes, haiku.module, and BaseParser.
We can display documentations for functions:
def validate_config( configs: Dict|BaseParser, # A configuration of the model/data. config_cls: BaseParser # The desired configuration class.) -> BaseParser:"""Return a valid configuration object.""" ...CustomizedMarkdownRenderer(validate_config)
validate_config
validate_config(configs, config_cls)
Return a valid configuration object.
Parameters:
configs (Dict | BaseParser) – A configuration of the model/data.
config_cls (BaseParser) – The desired configuration class.
Returns:
(BaseParser)
We can display documentations for classes:
class VanillaCF:"""VanillaCF Explanation of the model."""def__init__(self, configs: Dict|BaseParser=None# A configuration of the model. ): ...def generate_cf(self, x: np.ndarray, # A data point. pred_fn: Callable, # A prediction function. ) -> Array:"""Generate counterfactuals for the given data point."""pass __ALL__ = ["generate_cf"]CustomizedMarkdownRenderer(VanillaCF)
class VanillaCFConfig(BaseParser):"""Configuration for the `Model`.""" lr: float= Field(1e-3, description="Learning rate.") n_steps: int= Field(100, description="Number of iteration steps.")CustomizedMarkdownRenderer(VanillaCFConfig)