import lib parser = argparse.ArgumentParser() parser = lib.arg_all(parser) args = parser.parse_args() DIM = args.dim norm = nn.BatchNorm1d if DIM == 1 else nn.BatchNorm2d layer = norm(args.channels) model = nn.Sequential( layer, nn.Flatten(), nn.Linear(in_features=args.channels * args.numf**DIM, out_features=10)) train_dataset = give(DIM, args.numf, args.channels) if args.nodes > 1: model, train_loader = lib_torch.distribute(model, train_dataset, args.nodes, args.batch) else: train_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=args.batch, shuffle=True) time = lib_torch.profile(['batch_norm', 'NativeBatchNormBackward'], model, train_loader, args.epochs) import numpy as np data = np.array([[
parser = argparse.ArgumentParser() parser.add_argument('-numf', type=int, required=True) parser.add_argument('-batch', type=int, required=True) parser.add_argument('-nodes', type=int, required=True) parser.add_argument('-epochs', type=int, required=True) parser.add_argument('-units', type=int, required=True) args = parser.parse_args() layer = nn.Linear(in_features=args.numf, out_features=args.units) model = nn.Sequential( nn.Flatten(), nn.Linear(in_features=args.numf, out_features=args.units)) train_dataset = give(1, args.numf, 1, out_size=args.units) if args.nodes > 1: model, train_loader = lib_torch.distribute(model, train_dataset, args.nodes, args.batch) else: train_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=args.batch, shuffle=True) time = lib_torch.profile(['addmm', 'AddmmBackward'], model, train_loader, args.epochs) import numpy as np data = np.array([[
layer = nn.Linear( in_features = args.numf, out_features = args.units ) model = nn.Sequential( nn.Flatten(), layer, nn.Flatten(), nn.Linear( in_features = args.units, out_features = 10 ) ) train_dataset = give(1, args.numf, 1) if args.nodes > 1: model, train_loader = lib_torch.distribute(model, train_dataset, args.nodes, args.batch) else: train_loader = torch.utils.data.DataLoader( dataset = train_dataset, batch_size = args.batch, shuffle = True ) time = lib_torch.profile(['addmm', 'AddmmBackward'], model, train_loader, args.epochs) import numpy as np