Skip to content

Commit

Permalink
Change import: os.pardir -> '..'
Browse files Browse the repository at this point in the history
  • Loading branch information
koki0702 committed Apr 19, 2018
1 parent 350e021 commit f92e513
Show file tree
Hide file tree
Showing 45 changed files with 90 additions and 90 deletions.
4 changes: 2 additions & 2 deletions ch01/show_spiral_dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
from dataset import spiral
import matplotlib.pyplot as plt

Expand Down
4 changes: 2 additions & 2 deletions ch01/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from common.optimizer import SGD
from common.trainer import Trainer
Expand Down
4 changes: 2 additions & 2 deletions ch01/train_custom_loop.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from common.optimizer import SGD
from dataset import spiral
Expand Down
4 changes: 2 additions & 2 deletions ch01/two_layer_net.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from common.layers import Affine, Sigmoid, SoftmaxWithLoss

Expand Down
4 changes: 2 additions & 2 deletions ch02/count_method_big.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.util import most_similar, create_co_matrix, ppmi
from dataset import ptb
Expand Down
4 changes: 2 additions & 2 deletions ch02/count_method_small.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
import matplotlib.pyplot as plt
from common.util import preprocess, create_co_matrix, ppmi
Expand Down
4 changes: 2 additions & 2 deletions ch02/most_similar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.util import preprocess, create_co_matrix, most_similar


Expand Down
4 changes: 2 additions & 2 deletions ch02/ppmi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.util import preprocess, create_co_matrix, cos_similarity, ppmi

Expand Down
4 changes: 2 additions & 2 deletions ch02/show_ptb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from dataset import ptb


Expand Down
4 changes: 2 additions & 2 deletions ch02/similarity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.util import preprocess, create_co_matrix, cos_similarity


Expand Down
4 changes: 2 additions & 2 deletions ch03/cbow_predict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.layers import MatMul

Expand Down
4 changes: 2 additions & 2 deletions ch03/simple_cbow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.layers import MatMul, SoftmaxWithLoss

Expand Down
4 changes: 2 additions & 2 deletions ch03/simple_skip_gram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.layers import MatMul, SoftmaxWithLoss

Expand Down
4 changes: 2 additions & 2 deletions ch03/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
from common.trainer import Trainer
from common.optimizer import Adam
from simple_cbow import SimpleCBOW
Expand Down
4 changes: 2 additions & 2 deletions ch04/cbow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.layers import *
from ch04.negative_sampling_layer import NegativeSamplingLoss

Expand Down
4 changes: 2 additions & 2 deletions ch04/eval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.util import most_similar, analogy
import pickle
Expand Down
4 changes: 2 additions & 2 deletions ch04/negative_sampling_layer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.np import * # import numpy as np
from common.layers import Embedding, SigmoidWithLoss
import collections
Expand Down
4 changes: 2 additions & 2 deletions ch04/skip_gram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
from common.layers import *
from ch04.negative_sampling_layer import NegativeSamplingLoss

Expand Down
4 changes: 2 additions & 2 deletions ch04/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common import config
# GPUで実行する場合は、下記のコメントアウトを消去(要cupy)
Expand Down
4 changes: 2 additions & 2 deletions ch04/visualize_word2vec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import matplotlib.pyplot as plt
import numpy as np
from common.util import most_similar, analogy
Expand Down
4 changes: 2 additions & 2 deletions ch05/simple_rnnlm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.time_layers import *

Expand Down
4 changes: 2 additions & 2 deletions ch05/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.optimizer import SGD
from common.trainer import RnnlmTrainer
from dataset import ptb
Expand Down
4 changes: 2 additions & 2 deletions ch05/train_custom_loop.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import matplotlib.pyplot as plt
import numpy as np
from common.optimizer import SGD
Expand Down
4 changes: 2 additions & 2 deletions ch06/better_rnnlm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.time_layers import *
from common.np import * # import numpy as np
from common.base_model import BaseModel
Expand Down
4 changes: 2 additions & 2 deletions ch06/eval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from rnnlm import Rnnlm
from better_rnnlm import BetterRnnlm
from dataset import ptb
Expand Down
4 changes: 2 additions & 2 deletions ch06/rnnlm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.time_layers import *
from common.base_model import BaseModel

Expand Down
4 changes: 2 additions & 2 deletions ch06/train_better_rnnlm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common import config
# GPUで実行する場合は下記のコメントアウトを消去(要cupy)
# ==============================================
Expand Down
4 changes: 2 additions & 2 deletions ch06/train_rnnlm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.optimizer import SGD
from common.trainer import RnnlmTrainer
from common.util import eval_perplexity
Expand Down
4 changes: 2 additions & 2 deletions ch07/generate_better_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.np import *
from rnnlm_gen import BetterRnnlmGen
from dataset import ptb
Expand Down
4 changes: 2 additions & 2 deletions ch07/generate_text.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from rnnlm_gen import RnnlmGen
from dataset import ptb

Expand Down
4 changes: 2 additions & 2 deletions ch07/peeky_seq2seq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.time_layers import *
from ch07.seq2seq import Seq2seq, Encoder

Expand Down
4 changes: 2 additions & 2 deletions ch07/rnnlm_gen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
from common.functions import softmax
from ch06.rnnlm import Rnnlm
Expand Down
4 changes: 2 additions & 2 deletions ch07/seq2seq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.time_layers import *
from common.base_model import BaseModel

Expand Down
4 changes: 2 additions & 2 deletions ch07/show_addition_dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from dataset import sequence


Expand Down
4 changes: 2 additions & 2 deletions ch07/train_seq2seq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
import matplotlib.pyplot as plt
from dataset import sequence
Expand Down
4 changes: 2 additions & 2 deletions ch08/attention_layer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.np import * # import numpy as np
from common.layers import Softmax

Expand Down
4 changes: 2 additions & 2 deletions ch08/attention_seq2seq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.time_layers import *
from ch07.seq2seq import Encoder, Seq2seq
from ch08.attention_layer import TimeAttention
Expand Down
4 changes: 2 additions & 2 deletions ch08/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy as np
import matplotlib.pyplot as plt
from dataset import sequence
Expand Down
4 changes: 2 additions & 2 deletions ch08/visualize_attention.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import sys
sys.path.append('..') # 親ディレクトリのファイルをインポートするための設定
import numpy as np`
from dataset import sequence
import matplotlib.pyplot as plt
Expand Down
4 changes: 2 additions & 2 deletions common/base_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import pickle
from common.np import *
from common.util import to_gpu, to_cpu
Expand Down
4 changes: 2 additions & 2 deletions common/optimizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.np import *


Expand Down
4 changes: 2 additions & 2 deletions common/trainer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
import numpy
import time
import matplotlib.pyplot as plt
Expand Down
4 changes: 2 additions & 2 deletions common/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
from common.np import *


Expand Down
4 changes: 2 additions & 2 deletions dataset/ptb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
import sys, os
sys.path.append(os.pardir)
import sys
sys.path.append('..')
try:
import urllib.request
except ImportError:
Expand Down
Loading

0 comments on commit f92e513

Please sign in to comment.