start new:
tmux
start new with session name:
tmux new -s myname
## Check space on specfic directory | |
du -h --max-depth=0 /u/iali | |
du -h --max-depth=1 /u/iali |
coverage: ## Run tests with coverage | |
coverage erase | |
coverage run --include=podsearch/* -m pytest -ra | |
coverage report -m | |
deps: ## Install dependencies | |
pip install black coverage flake8 mypy pylint pytest tox | |
lint: ## Lint and static-check | |
flake8 podsearch |
import torch | |
from torch.utils.data import DataLoader, TensorDataset | |
# Define the dataset | |
X = torch.Tensor([[1, 2], [3, 4], [5, 6], [7, 8]]) | |
y = torch.Tensor([0, 1, 0, 1]) | |
dataset = TensorDataset(X, y) | |
# Create the dataloader | |
dataloader = DataLoader(dataset, batch_size=2, shuffle=True) |
import torch | |
# Create a tensor with values between 0 and 1 | |
tensor = torch.rand(3, 3) | |
# Set a threshold value | |
threshold = 0.5 | |
# Use torch.where to threshold the tensor | |
binary_tensor = torch.where(tensor > threshold, torch.tensor(1), torch.tensor(0)) |