def save_model(model):
    from torch import save
    from os import path
    for (n, m) in model_factory.items():
        if isinstance(model, m):
            return save(model.state_dict(), path.join(path.dirname(path.abspath(__file__)), ('%s.th' % n)))
    raise ValueError(("model type '%s' not supported!" % str(type(model))))
def save_model(model):
    from torch import save
    from os import path
    for (n, m) in model_factory.items():
        if isinstance(model, m):
            return save(model.state_dict(), path.join(path.dirname(path.abspath(__file__)), ('%s.th' % n)))
    raise ValueError(("model type '%s' not supported!" % str(type(model))))