Skip to content

Commit

Permalink
remove unused imports, add lint
Browse files Browse the repository at this point in the history
  • Loading branch information
astonzhang committed Jul 24, 2018
1 parent 7d18636 commit 36f866a
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 19 deletions.
3 changes: 1 addition & 2 deletions chapter_computer-vision/kaggle-gluon-cifar10.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ CIFAR-10是计算机视觉领域的一个重要的数据集。本节中,我们
```{.python .input}
import datetime
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet import autograd, gluon, init
from mxnet.gluon import data as gdata, nn, loss as gloss
import numpy as np
import os
import pandas as pd
import shutil
Expand Down
3 changes: 0 additions & 3 deletions chapter_computer-vision/kaggle-gluon-dog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import gluonbook as gb
import math
from mxnet import autograd, gluon, init, nd
from mxnet.gluon import data as gdata, loss as gloss, model_zoo, nn
import numpy as np
import os
import shutil
import zipfile
Expand Down Expand Up @@ -71,9 +70,7 @@ def reorg_dog_data(data_dir, label_file, train_dir, test_dir, input_dir,
lines = f.readlines()[1:]
tokens = [l.rstrip().split(',') for l in lines]
idx_label = dict(((idx, label) for idx, label in tokens))
labels = set(idx_label.values())
n_train = len(os.listdir(os.path.join(data_dir, train_dir)))
# 训练集中数量最少一类的狗的样本数。
min_n_train_per_label = (
collections.Counter(idx_label.values()).most_common()[:-2:-1][0][1])
Expand Down
2 changes: 1 addition & 1 deletion chapter_convolutional-neural-networks/batch-norm-gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```{.python .input n=1}
import gluonbook as gb
from mxnet import nd, gluon, init
from mxnet import gluon, init
from mxnet.gluon import loss as gloss, nn
net = nn.Sequential()
Expand Down
3 changes: 1 addition & 2 deletions chapter_convolutional-neural-networks/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
接下来我们实现处理多输入通道的相关运算符。首先我们将前面小节实现的`corr2d`复制过来。

```{.python .input n=2}
from mxnet import nd, autograd
from mxnet.gluon import nn
from mxnet import nd
def corr2d(X, K):
n, m = K.shape
Expand Down
1 change: 0 additions & 1 deletion chapter_convolutional-neural-networks/conv-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
下面我们将上述过程实现在`corr2d`函数里,它接受`X``K`,输出`Y`

```{.python .input}
import gluonbook as gb
from mxnet import autograd, nd
from mxnet.gluon import nn
Expand Down
2 changes: 1 addition & 1 deletion chapter_deep-learning-basics/dropout-gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

```{.python .input n=5}
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet import gluon, init
from mxnet.gluon import loss as gloss, nn
drop_prob1 = 0.2
Expand Down
2 changes: 1 addition & 1 deletion chapter_deep-learning-basics/dropout.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $$h_i = \frac{\xi_i}{1-p} \phi(x_1 w_1^{(i)} + x_2 w_2^{(i)} + x_3 w_3^{(i)} + x

```{.python .input}
import gluonbook as gb
from mxnet import autograd, gluon, nd
from mxnet import autograd, nd
from mxnet.gluon import loss as gloss
def dropout(X, drop_prob):
Expand Down
2 changes: 1 addition & 1 deletion chapter_deep-learning-basics/mlp-gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```{.python .input}
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet import gluon, init
from mxnet.gluon import loss as gloss, nn
```

Expand Down
2 changes: 1 addition & 1 deletion chapter_deep-learning-basics/mlp-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```{.python .input}
import gluonbook as gb
from mxnet import autograd, gluon, nd
from mxnet import nd
from mxnet.gluon import loss as gloss
```

Expand Down
2 changes: 1 addition & 1 deletion chapter_deep-learning-basics/softmax-regression-gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```{.python .input n=1}
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet import gluon, init
from mxnet.gluon import loss as gloss, nn
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ TODO(@astonzhang): edits
```{.python .input n=1}
import collections
import gluonbook as gb
import mxnet as mx
from mxnet import autograd, gluon, init, metric, nd
from mxnet.contrib import text
from mxnet.gluon import loss as gloss, nn, rnn
from mxnet.gluon import loss as gloss, nn
import os
import random
from time import time
Expand Down Expand Up @@ -183,7 +182,6 @@ glove_embedding = text.embedding.create(
import sys
sys.path.append('..')
import gluonbook as gb
from mxnet import autograd, nd
from mxnet.gluon import nn
def corr1d(X, K):
Expand Down
1 change: 0 additions & 1 deletion chapter_natural-language-processing/sentiment-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
```{.python .input n=1}
import collections
import gluonbook as gb
import mxnet as mx
from mxnet import autograd, gluon, init, metric, nd
from mxnet.contrib import text
from mxnet.gluon import loss as gloss, nn, rnn
Expand Down
1 change: 0 additions & 1 deletion chapter_recurrent-neural-networks/rnn-gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

```{.python .input n=1}
import gluonbook as gb
import mxnet as mx
from mxnet import autograd, gluon, init, nd
from mxnet.gluon import loss as gloss, nn, rnn, utils as gutils
import numpy as np
Expand Down

0 comments on commit 36f866a

Please sign in to comment.