timeit
applied to various Pytorch activation function on CPU and GPU, on a tensor of shape (20000,)
You must run this in a IPython session. Pytorch version is 2.0.0+cu117
.
See run.py
.
class Singleton(type): | |
_instances = {} | |
def __call__(cls, *args, **kwargs): | |
if cls not in cls._instances: | |
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) | |
return cls._instances[cls] | |
class MyClass(metaclass=Singleton): |
# TODO: replace black&isort by ruff | |
# TODO: how does this work with pre-commit? | |
# TODO: autopep/autoflake, bumpversion, docker build/push | |
SRC_DIR = my_project # CHANGE THIS | |
all: setup format lint-quick |
"""Versioning schema somewhere between [SemVer](https://semver.org/) and [CalVer](https://calver.org/). | |
Schema: MAJOR.MINOR.PATCH | |
where: | |
- MAJOR is manually incremented when breaking changes are introduced | |
- MINOR is the release year ("25" when we are in 2025) | |
- PATCH is the number of the day of the year (between 1 and 365) | |
Hence : |
{ | |
"if __name__ == \"__main__\":": { | |
"body": [ | |
"if __name__ == \"__main__\":\n\t$0" | |
], | |
"prefix": [ | |
"__name__", | |
"__main__", | |
] | |
}, |
import torch | |
import datasets | |
class HFDataset(torch.utils.data.Dataset): | |
def __init__(self, dset: datasets.Dataset): | |
self.dset = dset | |
def __getitem__(self, idx): | |
return self.dset[idx] |
%pip install pure-python-adb imageio | |
from ppadb.client import Client as AdbClient | |
# plug your android device with USB debugging | |
client = AdbClient(host="127.0.0.1", port=5037) | |
device = client.devices()[0] | |
screencap = device.screencap() |
Pop!_OS does not turn off your screen when you lock your screen. Where you hit tue Super+L
shortcut, it seems to start
some screensaver which display a black image and coincidently lock your session. But the screen itself does not go to
its standby mode.
Here is my solution:
<Super>l
shortcut occurences:
{dconf dump / ; gsettings list-recursively } | less
dconf-editor
to unset them