Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
Fix compatibility issues with Keras 2.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberZHG committed Aug 30, 2019
1 parent 3349dcf commit 005aa70
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 12 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: CyberZHG

---

**Describe the Bug**

A clear and concise description of what the bug is.

**Version Info**

* [ ] I'm using the latest version

**Minimal Codes To Reproduce**

```python
import keras_piecewise

pass
```
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: CyberZHG

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
@@ -0,0 +1,10 @@
---
name: Question
about: Ask questions about the repo
title: ''
labels: question
assignees: ''

---


2 changes: 2 additions & 0 deletions .github/stale.yml
@@ -0,0 +1,2 @@
daysUntilStale: 5
daysUntilClose: 2
28 changes: 23 additions & 5 deletions .travis.yml
@@ -1,16 +1,34 @@
dist: xenial
language: python
python:
- 2.7
- 3.6
env:
- KERAS_BACKEND=tensorflow
- KERAS_BACKEND=tensorflow TF_KERAS=1
- KERAS_BACKEND=tensorflow TF_KERAS=1 TF_EAGER=1
- KERAS_BACKEND=tensorflow TF_KERAS=1 TF_2=1
- KERAS_BACKEND=theano THEANO_FLAGS=optimizer=fast_compile
install:
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
- source activate test-environment
- export LD_LIBRARY_PATH=$HOME/miniconda/envs/test-environment/lib/:$LD_LIBRARY_PATH
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- if [[ $TF_2 == "1" ]]; then pip install tensorflow==2.0.0-beta1; fi
- if [[ $KERAS_BACKEND == "theano" ]]; then pip install theano && conda install mkl mkl-service; fi
- pip install coveralls
- pip install keras-piecewise
before_script:
- bash lint.sh
script:
- bash test.sh
- ./test.sh
after_success:
coveralls
10 changes: 8 additions & 2 deletions keras_piecewise/piecewise.py
Expand Up @@ -2,7 +2,13 @@
import keras.backend as K


class Piecewise(keras.layers.Wrapper):
try:
Wrapper = keras.layers.Wrapper
except AttributeError:
Wrapper = keras.layers.wrappers.Wrapper


class Piecewise(Wrapper):

POS_TYPE_SEGMENTS = 'segments'
POS_TYPE_PAIRS = 'pairs'
Expand Down Expand Up @@ -76,7 +82,7 @@ def compute_mask(self, inputs, mask=None):
return None


class Piecewise2D(keras.layers.Wrapper):
class Piecewise2D(Wrapper):

POS_TYPE_SEGMENTS = 'segments'
POS_TYPE_PAIRS = 'pairs'
Expand Down
2 changes: 0 additions & 2 deletions lint.sh

This file was deleted.

1 change: 1 addition & 0 deletions requirements-dev.txt
Expand Up @@ -4,3 +4,4 @@ wheel>=0.31.0
tensorflow
pycodestyle
coverage
nose
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -12,12 +12,12 @@

setup(
name='keras-piecewise',
version='0.12.0',
version='0.13.0',
packages=find_packages(),
url='https://github.com/CyberZHG/keras-piecewise',
license='MIT',
author='CyberZHG',
author_email='CyberZHG@gmail.com',
author_email='CyberZHG@users.noreply.github.com',
description='A wrapper layer for splitting and accumulating sequential data',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
3 changes: 2 additions & 1 deletion test.sh
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
nosetests --with-coverage --cover-html --cover-html-dir=htmlcov --cover-package="keras_piecewise" tests
pycodestyle --max-line-length=120 keras_piecewise tests && \
nosetests --nocapture --with-coverage --cover-erase --cover-html --cover-html-dir=htmlcov --cover-package=keras_piecewise --with-doctest

0 comments on commit 005aa70

Please sign in to comment.