Skip to content

Commit

Permalink
TF 1.0: clean upgrade by script, requirements and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Mar 11, 2017
1 parent 44624ab commit b839e73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ There is also implementations of the filters used in:
cd cnn_graph
```

2. Install the dependencies. Please edit `requirements.txt` to choose the
TensorFlow version (CPU / GPU, Linux / Mac) you want to install, or install
it beforehand. The code was developed with TF 0.8 but people have used it
with newer versions.
2. Install the dependencies. The code should run with TensorFlow 1.0 and newer.
```sh
pip install -r requirements.txt # or make install
```
Expand Down
8 changes: 4 additions & 4 deletions lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def _inference(self, x, dropout):
# Transform to Fourier domain
x_2d = tf.reshape(x, [-1, 28, 28])
x_2d = tf.complex(x_2d, 0)
xf_2d = tf.batch_fft2d(x_2d)
xf_2d = tf.fft2d(x_2d)
xf = tf.reshape(xf_2d, [-1, NFEATURES])
xf = tf.expand_dims(xf, 1) # NSAMPLES x 1 x NFEATURES
xf = tf.transpose(xf) # NFEATURES x 1 x NSAMPLES
Expand All @@ -361,7 +361,7 @@ def _inference(self, x, dropout):
W = tf.complex(Wreal, Wimg)
xf = xf[:int(NFEATURES/2), :, :]
yf = tf.matmul(W, xf) # for each feature
yf = tf.concat(values=[yf, tf.conj(yf)], axis=0)
yf = tf.concat([yf, tf.conj(yf)], axis=0)
yf = tf.transpose(yf) # NSAMPLES x NFILTERS x NFEATURES
yf_2d = tf.reshape(yf, [-1, 28, 28])
# Transform back to spatial domain
Expand Down Expand Up @@ -632,7 +632,7 @@ def _inference(self, x, dropout):
xt = tf.expand_dims(xt0, 0) # 1 x M x N
def concat(xt, x):
x = tf.expand_dims(x, 0) # 1 x M x N
return tf.concat(values=[xt, x], axis=0) # K x M x N
return tf.concat([xt, x], axis=0) # K x M x N
if self.K > 1:
xt1 = tf.sparse_tensor_dense_matmul(self.L, xt0)
xt = concat(xt, xt1)
Expand Down Expand Up @@ -893,7 +893,7 @@ def chebyshev5(self, x, L, Fout, K):
x = tf.expand_dims(x0, 0) # 1 x M x Fin*N
def concat(x, x_):
x_ = tf.expand_dims(x_, 0) # 1 x M x Fin*N
return tf.concat(values=[x, x_], axis=0) # K x M x Fin*N
return tf.concat([x, x_], axis=0) # K x M x Fin*N
if K > 1:
x1 = tf.sparse_tensor_dense_matmul(L, x0)
x = concat(x, x1)
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ scikit-learn
matplotlib

gensim
#https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.0.0b2.post2-cp34-none-linux_x86_64.whl
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
#https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
tensorflow-gpu
#tensorflow

jupyter
ipython

0 comments on commit b839e73

Please sign in to comment.