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 collections | |
import os | |
import numpy as np | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L |
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
"""Modified VGG16 to compute perceptual loss. | |
This class is mostly copied from pytorch/examples. | |
See, fast_neural_style in https://github.com/pytorch/examples. | |
""" | |
import torch | |
from torchvision import models | |
class VGG_OUTPUT(object): |
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 collections | |
import os | |
import numpy | |
try: | |
from PIL import Image | |
available = True | |
except ImportError as e: | |
available = False |
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 | |
import chainer | |
from chainer import configuration | |
from chainer import cuda | |
from chainer import functions | |
from chainer import initializers | |
from chainer import link | |
from chainer.utils import argument | |
from chainer import variable |
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 | |
from datetime import datetime as dt | |
import numpy as np | |
import onnx_caffe2.backend | |
import torch | |
import torch.nn as nn |
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 caffe2ai/caffe2:c2v0.8.1.cpu.min.ubuntu16.04 | |
LABEL maintainer="[email protected]" | |
# caffe2 install with cpu support | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
libgflags-dev \ | |
libgtest-dev \ | |
libiomp-dev \ | |
libleveldb-dev \ |
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 nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cmake \ | |
git \ | |
curl \ | |
vim \ | |
ca-certificates \ | |
libjpeg-dev \ |
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 chainer | |
from chainer.backends import cuda | |
import chainer.link_hooks | |
from chainer.link_hooks import _ForwardPreprocessCallbackArgs | |
from chainer import variable | |
def _get_axis(ndim, axis): | |
axes = [axis] | |
for i in range(ndim): |
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.nn as nn | |
from torch.nn.utils import spectral_norm | |
if __name__ == '__main__': | |
layer = nn.Conv2d(3, 15, 3, 1, 1) | |
layer = spectral_norm(layer) | |
torch.save(layer.state_dict(), 'tmp.pth') |
OlderNewer