source
get_device ()
device = get_device() print(device) print(f"Is MPS (Metal Performance Shader) built? {torch.backends.mps.is_built()}")
mps Is MPS (Metal Performance Shader) built? True
set_seed (seed:int=42)
set_seed()
Seed set to 42
time_it (func)
@time_it def hello(name): """Says hello to someone""" sleep(0.001) return f"Hello {name}!" print(hello.__name__) # Prints: "hello" print(hello.__doc__) # Prints: "Says hello to someone" print(hello('sylain'))
hello Says hello to someone hello: 0.105 seconds Hello sylain!