numpy advance index

# # tips: torch.tensor has the same indexing rules as numpy.ndarray import numpy as np a = np.array([ [11,12,13,14,15,16,17], [21,22,23,24,25,26,27], [31,32,33,34,35,36,37], [41,42,43,44,45,46,47], [51,52,53,54,55,56,57], ]) a[np.array([0,2,4])] a[np.array([0,2,4])].shape # 2D index will change data shape a[np.array([0,2,4]).reshape(-1,1)] a[np.array([0,2,4]).reshape(-1,1)].shape # 2D index as first index, can work with second array as index a[np.array([0,2,4]).reshape(-1,1), np.array([1,3,5])] a[np.array([0,2,4]).reshape(-1,1), np.array([1,3,5])].shape # np.where result as index idx = np.where(a[:,2]>30)[0] a[idx.reshape(-1,1),2:6].shape != a[idx.reshape(-1,1),range(2,6)].shape == a[idx,2:6].shape == a[idx][:,2:6].shape # boolean…

Ubuntu Install Docker

sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release curl -fsSL | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo \ “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \ $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli sudo usermod -aG docker $USER sudo systemctl enable docker sudo systemctl start docker

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!