Skip to content

Commit

Permalink
Only copy docs/source/notebooks if updated; convert Keras comments, i…
Browse files Browse the repository at this point in the history
…f pypandoc; create test wts in /tmp
  • Loading branch information
dsblank committed Aug 9, 2017
1 parent 54d4e13 commit 136b21b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ ENV/

# Rope project settings
.ropeproject

## conx specific:

docs/source/*.ipynb
tmp/
Makefile
19 changes: 4 additions & 15 deletions conx/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,12 @@
from keras.optimizers import (SGD, RMSprop, Adagrad, Adadelta, Adam, Adamax, Nadam,
TFOptimizer)

#------------------------------------------------------------------------

ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

#------------------------------------------------------------------------

pypandoc = None
if ON_RTD:
try:
import pypandoc
except:
pass # won't turn Keras comments into rft for documentation

try:
import pypandoc
except:
pass # won't turn Keras comments into rft for documentation
from .utils import *
#------------------------------------------------------------------------

ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

#------------------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions conx/tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_xor1():
net.set_dataset(dataset)
net.train(epochs=2000, accuracy=1, report_rate=25)
net.test()
net.save()
net.load()
net.save("/tmp/XOR.wts")
net.load("/tmp/XOR.wts")
svg = net.build_svg()
assert net is not None

Expand Down Expand Up @@ -72,8 +72,8 @@ def test_xor2():
net.propagate_to("hidden2", [[1], [1]])
net.propagate_to("output1", [[1], [1]])
net.propagate_to("output2", [[1], [1]])
net.save()
net.load()
net.save("/tmp/XOR2.wts")
net.load("/tmp/XOR2.wts")
net.test()
svg = net.build_svg()
assert net is not None
Expand Down
16 changes: 13 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@

## dependencies: get ../../notebooks/*.ipynb files

print("Copying source notebooks...")
print("Copying updated ../../notebooks/*.ipynb ...")
for filename in glob.glob("../../notebooks/*.ipynb"):
path, dst = os.path.split(filename)
shutil.copyfile(filename, dst)
print(" ", dst)
if os.path.isfile(dst): # dst exists here
dst_time = os.path.getmtime(dst)
src_time = os.path.getmtime(filename)
if src_time > dst_time: # the src time > dst time
copy_it = True # it is updated
else:
copy_it = False # not updated
else:
copy_it = True # doesn't exist
if copy_it:
shutil.copyfile(filename, dst)
print(" ", dst)

# -- General configuration ------------------------------------------------

Expand Down

0 comments on commit 136b21b

Please sign in to comment.