super_gradients.common.decorators package

Submodules

super_gradients.common.decorators.deci_logger module

super_gradients.common.decorators.deci_logger.deci_func_logger(_func=None, *, name: str = 'abstract_decorator')[source]

This decorator is used to wrap our functions with logs. It will log every enter and exit of the functon with the equivalent parameters as extras. It will also log exceptions that raises in the function. It will also log the exception time of the function.

How it works:`

First it will check if the decorator called with name keyword. If so it will return a new decorator that its logger is the name parameter. If not it will return a new decorator that its logger is the wrapped function name. Then the return decorator will return a new function that warps the original function with the new logs. For further understanding advise real-python “fancy decorators documentation”

Parameters
  • () (name) – used when called without name specify. dont pass it directly

  • () – The name of the logger to save logs by.

Returns

a decorator that wraps function with logs logic.

super_gradients.common.decorators.deci_logger.deci_class_logger()[source]

This decorator wraps every class method with deci_func_logger decorator. It works by checking if class method is callable and if so it will set a new decorated method as the same method name.

super_gradients.common.decorators.explicit_params_validator module

super_gradients.common.decorators.explicit_params_validator.explicit_params_validation(function: Optional[Callable] = None, validation_type: str = 'None')[source]

super_gradients.common.decorators.singleton module

class super_gradients.common.decorators.singleton.SingletonMeta[source]

Bases: type

A Singleton meta class. A class that derives from this class will have only 1 instance of that type for the process.

super_gradients.common.decorators.singleton.singleton(cls)[source]

A singleton decorator. Returns a wrapper objects. A call on that object returns a single instance object of decorated class. Use the __wrapped__ attribute to access decorated class directly in unit tests

Module contents

super_gradients.common.decorators.explicit_params_validation(function: Optional[Callable] = None, validation_type: str = 'None')[source]
super_gradients.common.decorators.singleton(cls)[source]

A singleton decorator. Returns a wrapper objects. A call on that object returns a single instance object of decorated class. Use the __wrapped__ attribute to access decorated class directly in unit tests