738 Commits

Autor SHA1 Mensagem Data
Taehoon Lee 205c61178d Update backend strings (#7214) 2017-07-06 04:27:07 -07:00
jorgecarleitao 985c441014 Improved error message for missing class_weights. (#7238)
The error is now a ValueError, as per docs, and contains
a suitable message.
2017-07-05 11:20:12 -07:00
Taehoon Lee 59cd1c3994 Fix typos (#7213) 2017-07-02 19:23:33 -07:00
NC Cullen 6c2dea64fc conv3d_transpose in tf, th, and cntk (#7161)
* conv3d_tranpose in tf and th

* fix _preprocess_deconv_output_shape error

* cntk conv3d_tranpose

* conv3d_tranpose test

* formatting

* cleanup tests

* fix incorrect axis ordering and docs

* fix incorrect axis ordering and docs

* deconv3d_output_shape to fix errors

* remove conv2d_transpose reference in theano backend

* remove kernel_size loop from test

* put depth first in test and add dim to invalid use case input

* formatting - removed extra line

* fix pep8

* remove extraneous args from tf conv3d_transpose function

* default val for data_format=None
2017-06-29 09:09:12 -07:00
Taehoon Lee c6ec39258b Fix styles (#7154) 2017-06-28 06:33:21 -07:00
Frédéric Branchaud-Charron a09c9f6c2d Fix test in training (#7149) 2017-06-27 13:19:54 -07:00
Somshubra Majumdar 49a7c7376d Addition of MobileNet to application (#7009)
* Add MobileNet to application

* Add support for 1001 classes in imagenet utils

* Revert a mistake in the tests

* Setup application test for mobilenet to run only when on tensorflow

* Correct pytest.mark.skipif explanation for skipping tests if not on tensorflow

* Corrected mobilenet to support 1000 classes and reverted imagenet_utils to prior state

* Fix tensorflow test

* Restrict mobilenets to data format "channels_last"

* Add review fixes

* PEP8 fix

* Add relu6 to activations.py

* Corrected imports in mobilenet.py

* Rolled back activation relu6 and inlined it to mobilenet.py

* Refactored DepthwiseConv2D and other corrections

* Fixed tests

* PEP8 correction

* Add docs to private functions and other fixes

* Fix failed test where input shape is None

* Fix value of size for model name
2017-06-27 11:11:48 -07:00
Andrew Hundt fb97b6e0fa _check_array_lengths properly handles corner cases with None (#7063)
* _check_array_lengths properly handles corner cases with None

* test_training.py _check_array_lengths() unit test

* set_of_lengths if/else + whitespace

* training.py pep8 whitespace

* training.py restate set more cleanly
2017-06-21 21:29:33 -07:00
Taehoon Lee 60cf7ca6b2 Fix typos (#7087) 2017-06-21 21:28:57 -07:00
Andrew Hundt 1b539993aa training.py _slice_arrays() fix crash when arrays are None (#7069)
* training.py _slice_arrays() fix crash when arrays are None

* training.py test _slice_arrays()
2017-06-21 18:01:30 -07:00
Andrew Hundt 219d6ee5be training.py _weighted_masked_objective fix crash when weights is None (#7068)
* training.py _weighted_masked_objective fix crash when weights is None

* unit test _weighted_masked_objective function
2017-06-21 13:46:55 -07:00
Andrew Hundt b713122e77 wrappers_test.py quick fix for flaky TimeDistributed test (#7062)
full issue: https://github.com/fchollet/keras/pull/7033
2017-06-21 10:50:58 -07:00
moi90 b5ad5334fc Add more numpy-style attributes to HDF5Matrix (#6982)
* Add more numpy-style attributes to HDF5Matrix

* Improve docstrings

* Add test coverage

* Add a ´# Returns´ section to shape, dtype, ndim, size.

* Remove whitespace in blank lines

* Use third-person and close docstrings on a new line.
2017-06-21 09:59:29 -07:00
Chris 04a20177cf Avoid DeprecationWarning from inspect.getargspec (rebased) (#7035)
* Utility function to check if a callable has a given keyword argument

* Added unit tests for the has_arg function

* Replace uses of getargspec with the new has_arg function

Not changing keras.backend, because that gives ImportErrors due to
a circular import (conv_utils uses the backend, and is imported
before generic_utils in utils/__init__.py)

Not changing keras.utils.test_utils, because that change exposes
(what looks to me like) a latent bug

* Replace incorrect use of getargspec in test_utils.py

The previous code would always fail to detect the 'weights' argument.
Simply replacing getargspec would cause the tests for some of the legacy
layers to fail because the passed 'weights' argument is bad.

Instead, I have added a check for whether the passed `weights` array
is empty, this avoids tripping the bug.

* Replacing getargspec with has_arg in the backend modules

This requires reordering imports to avoid errors caused by
conv_utils trying to import the backend, the backend wanting to
import generic_utils, and utils/__init__.py listing conv_utils
before generic_utils.

* Removed getargspec from legacy wrapping function

Instead save the wrapped function in an attribute and call
getargspec on this attribute during documentation generation.
2017-06-21 09:58:38 -07:00
Frédéric Branchaud-Charron 58d1d0678f Fix test in multiprocessing (#7058) 2017-06-20 15:56:45 -07:00
Francois Chollet abf8691ade Temp fix to multiprocessing tests 2017-06-20 12:48:18 -07:00
Frédéric Branchaud-Charron ab6b82c2db Fix the ordering bugs when using pickle_safe=True (#6891)
* Initial support for Datasets

* Fix warnings

* Fix for python2

* Fix travis deps

* Fix python2 indexing

* Fix test and docs

* Avoir use of future, use multiprocessing.pool

* Changed warning and better moduling

* fix threading test

* Move Dataset and enqueuers to utils.data_utils

* Skip None input, add seed for generators

* Skip None input fix

* pep8

* Fix example

* Add test in training and changed Dataset to hold item

* Revert to batch handling

* Docs update

* PEP8

* Rename in test

* Better documentation in Sequence

* Typo in sequence warning

* Rename pickle_safe and max_q_size, typos

* Typo in docstring

* Fix tests in training
2017-06-20 10:55:46 -07:00
Andrea Esuli 6814506528 Renamed one_hot function to hashing_trick, made hashing stable (#6887)
* Replaced one_hot function with hashing_trick

* Update text_test.py

* PEP8 fix

* Update text.py

* Put one_hot back, added documentation

* Changes following the review comments

* PEP8

* Chages after second review

* fixed wrong default for hashing_trick

* formatted documentation

* typo
2017-06-20 10:22:02 -07:00
Andrew Hundt 929ae992c2 test_multiprocessing.py fix incorrect use of numpy.random.randint (#7030)
* test_multiprocessing.py fix test which actually throws two exceptions

* test_multiprocessing.py fixed incorrect usage of np.random.randint()
https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.random.randint.html

* test_multiprocessing.py remove extra parens
2017-06-20 10:18:28 -07:00
Taehoon Lee 3d9428d344 Increase test coverage (#7037) 2017-06-19 12:12:50 -07:00
Rik Nijessen e0543fbfc8 throw an error when receiving empty batch, instead of returning nans at the end (#7038) 2017-06-19 11:23:41 -07:00
Taehoon Lee 7766ab341f Speed up Theano tests (#7011) 2017-06-17 16:26:07 -07:00
François Chollet 4135aeebc4 Revert "Avoid DeprecationWarning from inspect.getargspec (#6817)" (#7018)
This reverts commit ced84c4b42.
2017-06-16 20:47:14 -07:00
Chris ced84c4b42 Avoid DeprecationWarning from inspect.getargspec (#6817)
* Utility function to check if a callable has a given keyword argument

* Replace uses of getargspec with the new has_arg function

Not changing keras.backend, because that gives ImportErrors due to
a circular import (conv_utils uses the backend, and is imported
before generic_utils in utils/__init__.py)

Not changing keras.utils.test_utils, because that change exposes
(what looks to me like) a latent bug

* Added unit tests for the has_arg function

* Replace incorrect use of getargspec in test_utils.py

The previous code would always fail to detect the 'weights' argument.
Simply replacing getargspec would cause the tests for some of the legacy
layers to fail because the passed 'weights' argument is bad.

Instead, I have added a check for whether the passed `weights` array
is empty, this avoids tripping the bug.

* Replacing getargspec with has_arg in the backend modules

This requires reordering imports to avoid errors caused by
conv_utils trying to import the backend, the backend wanting to
import generic_utils, and utils/__init__.py listing conv_utils
before generic_utils.
2017-06-16 15:09:25 -07:00
Olli Huotari d3c33613a1 Keras 2 _*generator displaying warning always about semantic changes from Keras 1 (#7001)
* Warn always about semantic changes if having keras1 args in *_generator calls.

* modified api upgrade warning message to be more detailed

* minor fix to pep8 syntax
2017-06-16 12:48:44 -07:00
Francois Chollet f65a56fb65 Exclude CNTK from TimeDistributed learning phase test 2017-06-14 16:09:52 -07:00
Francois Chollet a625fcde5c Add learning phase support for TimeDistributed 2017-06-14 14:51:06 -07:00
Francois Chollet 73f374ec67 Merge branch 'master' of https://github.com/EntilZha/keras into EntilZha-master 2017-06-14 14:39:26 -07:00
Rizky Luthfianto 21cf50734a add Scaled Exponential Linear Unit activation (#6924)
* add Scaled Exponential Linear Unit activation

* selu: hardcode alpha and scale variable

* add AlphaDropout (from SELU), K.floor backend function, and tests

* move AlphaDropout from core layers to noise layers

* fix pep8 and tensorflow backend failure

* undo add (delete) K.floor on backends

* undo add (delete): selu in check_single_tensor_operation

* [skip ci] edit docstring

remove `alpha` and `scale` from docstring

* add(initializers): selu_normal

* fix: use 'q' instead of 'rate'

* [skip ci] update comment

* feat(AlphaDropout): add 'noise_shape' param back

* add SpatialAlphaDropout1D layer

* [skip ci] update comment

* [skip ci] remove unnecessary check

* update equation

* remove spatialalphadropout test

* fix(AlphaDropout): add get_config method

* [skip ci] s/selu_normal/lecun_normal

* [skip ci] fix docstring to LeCun normal init
2017-06-14 11:38:09 -07:00
Taehoon Lee 4a6f06f06d Increase test coverage (#6765)
* Increase test coverage

* Move sequence util and fix merge conflict
2017-06-14 09:34:15 -07:00
Chris f7b925a893 Use the pytest tmpdir fixture (#6901)
* Use the pytest tmpdir fixture (#6881)

* Run test_data_utils in a temporary directory

* Check output using os.path.isdir or os.path.isfile instead of os.path.exists

* Use the tmpdir fixture instead of mkdtemp

* Use in_tmpdir fixture when writing files in tests

... to avoid leaving files in the repository when tests fail, and also to
avoid the possibility of race conditions when several tests try to access
the same file.
2017-06-12 13:05:40 -07:00
Chen 11d9c995cc fixes #3859 clipnorm tensorflow (#6859)
* make clipnorm work with embeddings layer

* test for embedding + clipnorm

* update embedding_with_clipnorm test nb_epoch to epochs
2017-06-10 12:08:04 -07:00
Maxim Grechkin 846d25ab97 fix a bug when model.fit assumed that x[0] has len, not true for sparse matrices (#6916) 2017-06-08 21:20:00 -07:00
fchollet 43e418d1d2 Deflake TensorBoard callback tests. 2017-06-06 23:08:48 -07:00
Cheng Tang 75d9415c82 Add CNTK backend. 2017-06-06 23:03:04 -07:00
Francois Chollet 552978dc58 Allow arbitrary channel dimensions in ImageDataGenerator 2017-06-06 16:29:08 -07:00
Francois Chollet 508bb8f541 Add new return_state test for RNNs 2017-06-06 13:15:31 -07:00
Francois Chollet c3c97905fe merge return_state keyword in RNN API 2017-06-06 12:41:59 -07:00
Francois Chollet f0659766fc Merge branch 'return-state' of https://github.com/Joshua-Chin/keras into Joshua-Chin-return-state 2017-06-06 12:17:21 -07:00
Jeremy Fix 3c180eafed Serializing/Desrializing numpy arrays in Lambda layer arguments (#6816)
* Serialize/Deserialize numpy arrays passed as arguments to Lambda layers

* Serialize/Deserialize numpy arrays passed as arguments to Lambda layers

* Corrections from fchollet comments

* corrections

* Removes warning and adds a unit test

* pep8 corrections
2017-06-06 09:20:49 -07:00
Vimos Tan 0bc8fac446 Add sparse_top_k_categorical_accuracy and test code (#6840)
* Add top_k_sparse_categorical_accuracy and test_top_k_sparse_categorical_accuracy

* Rename top_k_sparse_categorical_accuracy and sparse_top_k_categorical_accuracy
2017-06-04 16:23:57 -07:00
Francois Chollet 7819b9c14e Update categorical_hinge loss 2017-06-02 12:01:00 -07:00
Eric Xihui Lin f3bbf31497 Modify embedding to accept arbitrary input dim (#6392)
* modifed embedding to accept arbitrary input dim

* allowed user specified input lengths

* minor change
2017-05-31 16:05:20 -07:00
Taehoon Lee bfa38fb747 Add warning message for redundant outputs (#6738) 2017-05-26 14:28:53 -07:00
cocuh 7e870a97ec Fix edge cases of custom object deserialization 2017-05-23 11:30:45 -07:00
meberstein 85fe6427a5 Added hinge loss for categorical classification (#6687)
* Fix bug in EarlyStopping to reset stopped_epoch in on_train_begin to allow it to be re-used

* Added hinge loss for categorical classification
2017-05-23 10:49:23 -07:00
Matt Gardner b5490b20d2 Fix depth calculation for shared layers (#6668)
* Fixed depth calculation for shared layers

* Added a failing test

* Update the node's depth too
2017-05-19 16:54:03 -07:00
Kevin Mader 6220e35ccd adding io_utils test for hdf5matrix (#6610)
* adding io_utils test for hdf5matrix

* incorporating pep8 and feedback from @fchollet
2017-05-14 10:40:28 -07:00
Kyle Dorman d67cf89759 Better error message for invalid functional api inputs (#6589) (#6593)
* Better error message for invalid funcational api inputs (#6589)

* raise ValueError if `inputs` is not a Keras tensor

* Move  to respective backends

* raise error if is_keras_tensor is called on a non-tensor object

* Fix failing tests

* responding to comments

* Update docstring comments to better explain expected behavior
2017-05-12 11:04:27 -07:00
Gökçen Eraslan a2dde60a2f TensorBoard: Embed only given layers (#6565)
* TensorBoard: Embed only given layers.

* TensorBoard: Fix pep8
2017-05-11 14:34:33 -07:00