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
.
{ | |
"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@profile | |
def func1(i: float): | |
import time | |
time.sleep(i) | |
@profile | |
def func_mother(): | |
func1(1.2) | |
a = 2 + 3 |
from fast_flask import Flask | |
app = Flask(__name__) | |
@app.get("/users/") # equivalent to `@app.route("/users/")` from flask.Flask | |
def get_user_details(user_id: int = 123): | |
return {"123": "bob"} | |
if __name__ == "__main__": |
import gradio as gr | |
import numpy as np | |
import tensorflow as tf | |
import requests | |
# Load a classification model | |
model = tf.keras.applications.MobileNetV3Large( | |
input_shape=None, | |
alpha=1.0, | |
minimalistic=False, |