What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-27 11:30:13
tensorboardx
# demo.py import torch import torchvision.utils as vutils import numpy as np import torchvision.models as models from torchvision import datasets from tensorboardX import SummaryWriter resnet18 = models.resnet18(False) writer = SummaryWriter() sample_ra... Add solution -
Python 2022-03-09 15:25:04
time df.apply() python
import pandas as pd import numpy as np from tqdm import tqdm # from tqdm.auto import tqdm # for notebooks df = pd.DataFrame(np.random.randint(0, int(1e8), (10000, 1000))) # Create and register a new `tqdm` instance with `pandas` # (can use tqdm_gui, op... Add solution -
Python 2022-03-03 05:15:16
random choice without random module
# First let's make a function that makes a random number def randint(a, b): "Return random integer in range [a, b], including both end points." return a + randbelow(b - a + 1) def randbelow(n): "Return a random int in the ran... Add solution -
Python 2022-02-27 03:55:15
add column python list
T = NP.random.randint(0, 10, 20).reshape(5, 4) c = NP.random.randint(0, 10, 5) r = NP.random.randint(0, 10, 4) # add a column to T, at the front: NP.insert(T, 0, c, axis=1) # add a column to T, at the end: NP.insert(T, 4, c, axis=1) # add a row to T betwe... Add solution -
Other 2022-02-19 23:45:03
how to use validation split data as validation data in callback
x = np.random.randn(150, 9) y = np.random.randint(0, 10, 150) x_train, y_train, x_val, y_val = split(x, y) train_dataset = tf.data.Dataset.from_tensor_slices((x_train, tf.one_hot(y_train, depth=10))) train_dataset = train_dataset.batch(32).repeat() val... Add solution -
Python 2022-02-13 15:30:05
How to replace both the diagonals of dataframe with 0 in pandas
import pandas as pd import numpy as np df = pd.DataFrame(np.random.randint(1,100, 100).reshape(10, -1)) out = df.where(df.values != np.diag(df),0,df.where(df.values != np.flipud(df).diagonal(0),0,inplace=True)) Add solution -
Python 2022-02-12 07:45:15
how to make otp generator in python
# Python Program for simple OTP genertaor import random as r # function for otp generation def otpgen(): otp="" for i in range(4): otp+=str(r.randint(1,9)) print ("Your One Time Password is ") print (otp) otpgen() Add solution
Best helpers
Ranking is empty