This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import torch | |
import torch.nn as nn | |
def test(cudnn, benchmark, dtype): | |
print('cudnn {}, benchmark {}, dtype {}'.format(cudnn, benchmark, dtype)) | |
torch.backends.cudnn.enabled = cudnn | |
torch.backends.cudnn.benchmark = benchmark |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import time | |
torch.backends.cudnn.benchmark = True | |
# 1a) | |
I, J, K = 64, 1024, 1024 | |
A = torch.randn(I, J, device='cuda', dtype=torch.half) | |
B = torch.randn(J, K, device='cuda', dtype=torch.half) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
def print_types(input, bn, output): | |
print('input.type(): {}'.format(input.type())) | |
if bn.weight is not None: | |
print('bn.weight.type(): {}'.format(bn.weight.type())) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import pandas as pd | |
import time | |
torch.backends.cudnn.deterministic = False | |
torch.backends.cudnn.benchmark = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
from apex import amp | |
class MyModel(nn.Module): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
from torch.utils.data import DataLoader, TensorDataset | |
from apex import amp | |
from torchcontrib.optim import SWA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
from apex import amp | |
class SiameseTower(nn.Module): | |
def __init__(self, inplanes=3, planes=32,blocks=3): | |
super(SiameseTower, self).__init__() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
import torch | |
import matplotlib | |
matplotlib.use("agg") | |
from torch.backends import cudnn | |
from apex import amp | |
import argparse | |
from torch import cuda | |
from torch import nn | |
from urllib import request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import argparse | |
import os | |
import random | |
import torch | |
import torch.nn as nn | |
import torch.nn.parallel | |
import torch.backends.cudnn as cudnn | |
import torch.optim as optim | |
import torch.utils.data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.nn.functional as F | |
from torch.utils.data import Dataset | |
from torch.utils.data.dataloader import DataLoader |