def create_backend(name, **kwargs): if isinstance(name, Backend): return name if name is None and has_horovodrun(): name = HOROVOD return backend_registry[name](**kwargs)
def create_backend(backend): if isinstance(backend, Backend): return backend if backend is None and has_horovodrun(): backend = HOROVOD return backend_registry[backend]()
def create_backend(type, **kwargs): if isinstance(type, Backend): return type if type is None and _has_ray(): type = RAY elif type is None and has_horovodrun(): type = HOROVOD return backend_registry[type](**kwargs)