Keras

Latest version: v3.4.0

Safety actively analyzes 640986 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 9 of 12

2.2.5

Not secure
Keras 2.2.5 is the last release of Keras that implements the 2.2.* API. It is the last release to only support TensorFlow 1 (as well as Theano and CNTK).

The next release will be 2.3.0, which makes significant API changes and add support for TensorFlow 2.0. The 2.3.0 release will be the last major release of multi-backend Keras. Multi-backend Keras is superseded by `tf.keras`.

At this time, we recommend that Keras users who use multi-backend Keras with the TensorFlow backend switch to `tf.keras` in TensorFlow 2.0. `tf.keras` is better maintained and has better integration with TensorFlow features.

API Changes

* Add new Applications: `ResNet101`, `ResNet152`, `ResNet50V2`, `ResNet101V2`, `ResNet152V2`.
* Callbacks: enable callbacks to be passed in `evaluate` and `predict`.
- Add `callbacks` argument (list of callback instances) in `evaluate` and `predict`.
- Add callback methods `on_train_batch_begin`, `on_train_batch_end`, `on_test_batch_begin`, `on_test_batch_end`, `on_predict_batch_begin`, `on_predict_batch_end`, as well as `on_test_begin`, `on_test_end`, `on_predict_begin`, `on_predict_end`. Methods `on_batch_begin` and `on_batch_end` are now aliases for `on_train_batch_begin` and `on_train_batch_end`.
* Allow file pointers in `save_model` and `load_model` (in place of the filepath)
* Add `name` argument in Sequential constructor
* Add `validation_freq` argument in `fit`, controlling the frequency of validation (e.g. setting `validation_freq=3` would run validation every 3 epochs)
* Allow Python generators (or Keras Sequence objects) to be passed in `fit`, `evaluate`, and `predict`, instead of having to use `*_generator` methods.
- Add generator-related arguments `max_queue_size`, `workers`, `use_multiprocessing` to these methods.
* Add `dilation_rate` argument in layer `DepthwiseConv2D`.
* MaxNorm constraint: rename argument `m` to `max_value`.
* Add `dtype` argument in base layer (default dtype for layer's weights).
* Add Google Cloud Storage support for model.save_weights and model.load_weights.
* Add JSON-serialization to the `Tokenizer` class.
* Add `H5Dict` and `model_to_dot` to utils.
* Allow default Keras path to be specified at startup via environment variable KERAS_HOME.
* Add arguments `expand_nested`, `dpi` to `plot_model`.
* Add `update_sub`, `stack`, `cumsum`, `cumprod`, `foldl`, `foldr` to CNTK backend
* Add `merge_repeated` argument to `ctc_decode` in TensorFlow backend

Thanks to the 89 committers who contributed code to this release!

2.2.4

Not secure
This is a bugfix release, addressing two issues:

- Ability to save a model when a file with the same name already exists.
- Issue with loading legacy config files for the `Sequential` model.

[See here](https://github.com/keras-team/keras/releases/tag/2.2.3) for the changelog since 2.2.2.

2.2.3

Not secure
Areas of improvement

- API completeness & usability improvements
- Bug fixes
- Documentation improvements

API changes

- Keras models can now be safely pickled.
- Consolidate the functionality of the activation layers `ThresholdedReLU` and `LeakyReLU` into the `ReLU` layer.
- As a result, the `ReLU` layer now takes new arguments `negative_slope` and `threshold`, and the `relu` function in the backend takes a new `threshold` argument.
- Add `update_freq` argument in `TensorBoard` callback, controlling how often to write TensorBoard logs.
- Add the `exponential` function to `keras.activations`.
- Add `data_format` argument in all 4 `Pooling1D` layers.
- Add `interpolation` argument in `UpSampling2D` layer and in `resize_images` backend function, supporting modes `"nearest"` (previous behavior, and new default) and `"bilinear"` (new).
- Add `dilation_rate` argument in `Conv2DTranspose` layer and in `conv2d_transpose` backend function.
- The `LearningRateScheduler` now receives the `lr` key as part of the `logs` argument in `on_epoch_end` (current value of the learning rate).
- Make `GlobalAveragePooling1D` layer support masking.
- The the `filepath` argument `save_model` and `model.save()` can now be a `h5py.Group` instance.
- Add argument `restore_best_weights` to `EarlyStopping` callback (optionally reverts to the weights that obtained the highest monitored score value).
- Add `dtype` argument to `keras.utils.to_categorical`.
- Support `run_options` and `run_metadata` as optional session arguments in `model.compile()` for the TensorFlow backend.

Breaking changes

- Modify the return value of `Sequential.get_config()`. Previously, the return value was a list of the config dictionaries of the layers of the model. Now, the return value is a dictionary with keys `layers`, `name`, and an optional key `build_input_shape`. The old config is equivalent to `new_config['layers']`. This makes the output of `get_config` consistent across all model classes.


Credits

Thanks to our 38 contributors whose commits are featured in this release:

BertrandDechoux, ChrisGll, Dref360, JamesHinshelwood, MarcoAndreaBuchmann, ageron, alfasst, blue-atom, chasebrignac, cshubhamrao, danFromTelAviv, datumbox, farizrahman4u, fchollet, fuzzythecat, gabrieldemarmiesse, hadifar, heytitle, hsgkim, jankrepl, joelthchao, knightXun, kouml, linjinjin123, lvapeab, nikoladze, ozabluda, qlzh727, roywei, rvinas, sriyogesh94, tacaswell, taehoonlee, tedyu, xuhdev, yanboliang, yongzx, yuanxiaosc

2.2.2

Not secure
This is a bugfix release, fixing a significant bug in `multi_gpu_model`.

For changes since version 2.2.0, see release notes for [Keras 2.2.1](https://github.com/keras-team/keras/releases/tag/2.2.1).

2.2.1

Not secure
Areas of improvement

- Bugs fixes
- Performance improvements
- Documentation improvements

API changes

- Add `output_padding` argument in `Conv2DTranspose` (to override default padding behavior).
- Enable automatic shape inference when using Lambda layers with the CNTK backend.

Breaking changes

No breaking changes recorded.

Credits

Thanks to our 33 contributors whose commits are featured in this release:

Ajk4, Anner-deJong, Atcold, Dref360, EyeBool, ageron, briannemsick, cclauss, davidtvs, dstine, eTomate, ebatuhankaynak, eliberis, farizrahman4u, fchollet, fuzzythecat, gabrieldemarmiesse, jlopezpena, kamil-kaczmarek, kbattocchi, kmader, kvechera, maxpumperla, mkaze, pavithrasv, rvinas, sachinruk, seriousmac, soumyac1999, taehoonlee, yanboliang, yongzx, yuyang-huang

2.2.0

Not secure
Areas of improvements

- New model definition API: `Model` subclassing.
- New input mode: ability to call models on TensorFlow tensors directly (TensorFlow backend only).
- Improve feature coverage of Keras with the Theano and CNTK backends.
- Bug fixes and performance improvements.
- Large refactors improving code structure, code health, and reducing test time. In particular:
* The Keras engine now follows a much more modular structure.
* The `Sequential` model is now a plain subclass of `Model`.
* The modules `applications` and `preprocessing` are now externalized to their own repositories ([keras-applications](https://github.com/keras-team/keras-applications) and [keras-preprocessing](https://github.com/keras-team/keras-preprocessing)).

API changes

- Add `Model` subclassing API (details below).
- Allow symbolic tensors to be fed to models, with TensorFlow backend (details below).
- Enable CNTK and Theano support for layers `SeparableConv1D`, `SeparableConv2D`, as well as backend methods `separable_conv1d` and `separable_conv2d` (previously only available for TensorFlow).
- Enable CNTK and Theano support for applications `Xception` and `MobileNet` (previously only available for TensorFlow).
- Add `MobileNetV2` application (available for all backends).
- Enable loading external (non built-in) backends by changing your `~/.keras.json` configuration file (e.g. PlaidML backend).
- Add `sample_weight` in `ImageDataGenerator`.
- Add `preprocessing.image.save_img` utility to write images to disk.
- Default `Flatten` layer's `data_format` argument to `None` (which defaults to global Keras config).
- `Sequential` is now a plain subclass of `Model`. The attribute `sequential.model` is deprecated.
- Add `baseline` argument in `EarlyStopping` (stop training if a given baseline isn't reached).
- Add `data_format` argument to `Conv1D`.
- Make the model returned by `multi_gpu_model` serializable.
- Support input masking in `TimeDistributed` layer.
- Add an `advanced_activation` layer `ReLU`, making the ReLU activation easier to configure while retaining easy serialization capabilities.
- Add `axis=-1` argument in backend crossentropy functions specifying the class prediction axis in the input tensor.

New model definition API : `Model` subclassing

In addition to the `Sequential` API and the functional `Model` API, you may now define models by subclassing the `Model` class and writing your own `call` forward pass:

python
import keras

class SimpleMLP(keras.Model):

def __init__(self, use_bn=False, use_dp=False, num_classes=10):
super(SimpleMLP, self).__init__(name='mlp')
self.use_bn = use_bn
self.use_dp = use_dp
self.num_classes = num_classes

self.dense1 = keras.layers.Dense(32, activation='relu')
self.dense2 = keras.layers.Dense(num_classes, activation='softmax')
if self.use_dp:
self.dp = keras.layers.Dropout(0.5)
if self.use_bn:
self.bn = keras.layers.BatchNormalization(axis=-1)

def call(self, inputs):
x = self.dense1(inputs)
if self.use_dp:
x = self.dp(x)
if self.use_bn:
x = self.bn(x)
return self.dense2(x)

model = SimpleMLP()
model.compile(...)
model.fit(...)


Layers are defined in `__init__(self, ...)`, and the forward pass is specified in `call(self, inputs)`. In `call`, you may specify custom losses by calling `self.add_loss(loss_tensor)` (like you would in a custom layer).

New input mode: symbolic TensorFlow tensors

With Keras 2.2.0 and TensorFlow 1.8 or higher, you may `fit`, `evaluate` and `predict` using symbolic TensorFlow tensors (that are expected to yield data indefinitely). The API is similar to the one in use in `fit_generator` and other generator methods:

python
iterator = training_dataset.make_one_shot_iterator()
x, y = iterator.get_next()

model.fit(x, y, steps_per_epoch=100, epochs=10)

iterator = validation_dataset.make_one_shot_iterator()
x, y = iterator.get_next()
model.evaluate(x, y, steps=50)


This is achieved by dynamically rewiring the TensorFlow graph to feed the input tensors to the existing model placeholders. There is no performance loss compared to building your model on top of the input tensors in the first place.


Breaking changes

- Remove legacy `Merge` layers and associated functionality (remnant of Keras 0), which were deprecated in May 2016, with full removal initially scheduled for August 2017. Models from the Keras 0 API using these layers cannot be loaded with Keras 2.2.0 and above.
- The `truncated_normal` base initializer now returns values that are scaled by ~0.9 (resulting in correct variance value after truncation). This has a small chance of affecting initial convergence behavior on some models.


Credits

Thanks to our 46 contributors whose commits are featured in this release:

ASvyatkovskiy, AmirAlavi, Anirudh-Swaminathan, DavidAriel, Dref360, JonathanCMitchell, KuzMenachem, PeterChe1990, Saharkakavand, StefanoCappellini, ageron, askskro, bileschi, bonlime, bottydim, brge17, briannemsick, bzamecnik, christian-lanius, clemens-tolboom, dschwertfeger, dynamicwebpaige, farizrahman4u, fchollet, fuzzythecat, ghostplant, giuscri, huyu398, jnphilipp, masstomato, morenoh149, mrTsjolder, nittanycolonial, r-kellerm, reidjohnson, roatienza, sbebo, stevemurr, taehoonlee, tiferet, tkoivisto, tzerrell, vkk800, wangkechn, wouterdobbels, zwang36wang

Page 9 of 12

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.