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 tensorflow as tf | |
| from tensorflow.contrib import learn | |
| from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib | |
| tf.logging.set_verbosity(tf.logging.INFO) | |
| def cnn_model_fn(features, labels, mode): |
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 torchvision import datasets, transforms | |
| from torch.autograd import Variable | |
| # download and transform train dataset | |
| train_loader = torch.utils.data.DataLoader(datasets.MNIST('../mnist_data', | |
| download=True, |