v2.8.0-rc0
版本发布时间: 2021-12-23 02:26:23
keras-team/keras最新发布版本:v3.6.0(2024-10-04 03:44:23)
Please see https://github.com/tensorflow/tensorflow/blob/r2.8/RELEASE.md for Keras release notes.
-
tf.keras
:- Preprocessing Layers
- Added a
tf.keras.layers.experimental.preprocessing.HashedCrossing
layer which applies the hashing trick to the concatenation of crossed scalar inputs. This provides a stateless way to try adding feature crosses of integer or string data to a model. - Removed
keras.layers.experimental.preprocessing.CategoryCrossing
. Users should migrate to theHashedCrossing
layer or usetf.sparse.cross
/tf.ragged.cross
directly. - Added additional
standardize
andsplit
modes toTextVectorization
.-
standardize="lower"
will lowercase inputs. -
standardize="string_punctuation"
will remove all puncuation. -
split="character"
will split on every unicode character.
-
- Added an
output_mode
argument to theDiscretization
andHashing
layers with the same semantics as other preprocessing layers. All categorical preprocessing layers now supportoutput_mode
. - All preprocessing layer output will follow the compute dtype of a
tf.keras.mixed_precision.Policy
, unless constructed withoutput_mode="int"
in which case output will betf.int64
. The output type of any preprocessing layer can be controlled individually by passing adtype
argument to the layer.
- Added a
-
tf.random.Generator
for keras initializers and all RNG code.- Added 3 new APIs for enable/disable/check the usage of
tf.random.Generator
in keras backend, which will be the new backend for all the RNG in Keras. We plan to switch on the new code path by default in tf 2.8, and the behavior change will likely to cause some breakage on user side (eg if the test is checking against some golden nubmer). These 3 APIs will allow user to disable and switch back to legacy behavior if they prefer. In future (eg tf 2.10), we expect to totally remove the legacy code path (stateful random Ops), and these 3 APIs will be removed as well.
- Added 3 new APIs for enable/disable/check the usage of
-
tf.keras.callbacks.experimental.BackupAndRestore
is now available astf.keras.callbacks.BackupAndRestore
. The experimental endpoint is deprecated and will be removed in a future release. -
tf.keras.experimental.SidecarEvaluator
is now available astf.keras.utils.SidecarEvaluator
. The experimental endpoint is deprecated and will be removed in a future release. - Metrics update and collection logic in default
Model.train_step()
is now customizable via overridingModel.compute_metrics()
. - Losses computation logic in default
Model.train_step()
is now customizable via overridingModel.compute_loss()
. -
jit_compile
added toModel.compile()
on an opt-in basis to compile the model's training step with XLA. Note thatjit_compile=True
may not necessarily work for all models.
- Preprocessing Layers
What's Changed
- Cleanup legacy Keras files by @qlzh727 in https://github.com/keras-team/keras/pull/14256
- Sync OSS keras to head. by @qlzh727 in https://github.com/keras-team/keras/pull/14300
- Update build script for GPU build. by @copybara-service in https://github.com/keras-team/keras/pull/14336
- Move the LossReduction class from tf to Keras. by @copybara-service in https://github.com/keras-team/keras/pull/14362
- Update keras API generate script. by @copybara-service in https://github.com/keras-team/keras/pull/14418
- Adding extra target that are needed by PIP package dependency. by @copybara-service in https://github.com/keras-team/keras/pull/14421
- Add test related targets to PIP package list. by @copybara-service in https://github.com/keras-team/keras/pull/14427
- Sync OSS keras to head. by @copybara-service in https://github.com/keras-team/keras/pull/14428
- Update visibility setting for keras/tests to enable PIP package testing. by @copybara-service in https://github.com/keras-team/keras/pull/14429
- Remove items from PIP_EXCLUDED_FILES which is needed with testing PIP. by @copybara-service in https://github.com/keras-team/keras/pull/14431
- Split bins into num_bins and bin_boundaries arguments for discretization by @copybara-service in https://github.com/keras-team/keras/pull/14507
- Update pbtxt to use _PRFER_OSS_KERAS=1. by @copybara-service in https://github.com/keras-team/keras/pull/14519
- Sync OSS keras to head. by @copybara-service in https://github.com/keras-team/keras/pull/14572
- Sync OSS keras to head. by @copybara-service in https://github.com/keras-team/keras/pull/14614
- Cleanup the bazelrc and remove unrelated items to keras. by @copybara-service in https://github.com/keras-team/keras/pull/14616
- Sync OSS keras to head. by @copybara-service in https://github.com/keras-team/keras/pull/14624
- Remove object metadata when saving SavedModel. by @copybara-service in https://github.com/keras-team/keras/pull/14697
- Fix static shape inference for Resizing layer. by @copybara-service in https://github.com/keras-team/keras/pull/14712
- Make TextVectorization work with list input. by @copybara-service in https://github.com/keras-team/keras/pull/14711
- Remove deprecated methods of Sequential model. by @copybara-service in https://github.com/keras-team/keras/pull/14714
- Improve Model docstrings by @copybara-service in https://github.com/keras-team/keras/pull/14726
- Add migration doc for legacy_tf_layers/core.py. by @copybara-service in https://github.com/keras-team/keras/pull/14740
- PR #43417: Fixes #42872: map_to_outputs_names always returns a copy by @copybara-service in https://github.com/keras-team/keras/pull/14755
- Rename the keras.py to keras_lib.py to resolve the name conflict during OSS test. by @copybara-service in https://github.com/keras-team/keras/pull/14778
- Switch to tf.io.gfile for validating vocabulary files. by @copybara-service in https://github.com/keras-team/keras/pull/14788
- Avoid serializing generated thresholds for AUC metrics. by @copybara-service in https://github.com/keras-team/keras/pull/14789
- Fix data_utils.py when name ends with
.tar.gz
by @copybara-service in https://github.com/keras-team/keras/pull/14777 - Fix lookup layer oov token check when num_oov_indices > len(vocabulary tokens) by @copybara-service in https://github.com/keras-team/keras/pull/14793
- Update callbacks.py by @jvishnuvardhan in https://github.com/keras-team/keras/pull/14760
- Fix keras metric.result_state when the metric variables are sharded variable. by @copybara-service in https://github.com/keras-team/keras/pull/14790
- Fix typos in CONTRIBUTING.md by @amogh7joshi in https://github.com/keras-team/keras/pull/14642
- Fixed ragged sample weights by @DavideWalder in https://github.com/keras-team/keras/pull/14804
- Pin the protobuf version to 3.9.2 which is same as the TF. by @copybara-service in https://github.com/keras-team/keras/pull/14835
- Make variable scope shim regularizer adding check for attribute presence instead of instance class by @copybara-service in https://github.com/keras-team/keras/pull/14837
- Add missing license header for leakr check. by @copybara-service in https://github.com/keras-team/keras/pull/14840
- Fix TextVectorization with output_sequence_length on unknown input shapes by @copybara-service in https://github.com/keras-team/keras/pull/14832
- Add more explicit error message for instance type checking of optimizer. by @copybara-service in https://github.com/keras-team/keras/pull/14846
- Set aggregation for variable when using PS Strategy for aggregating variables when running multi-gpu tests. by @copybara-service in https://github.com/keras-team/keras/pull/14845
- Remove unnecessary reshape layer in MobileNet architecture by @copybara-service in https://github.com/keras-team/keras/pull/14854
- Removes caching of the convolution tf.nn.convolution op. While this provided some performance benefits, it also produced some surprising behavior for users in eager mode. by @copybara-service in https://github.com/keras-team/keras/pull/14855
- Output int64 by default from Discretization by @copybara-service in https://github.com/keras-team/keras/pull/14841
- add patterns to .gitignore by @haifeng-jin in https://github.com/keras-team/keras/pull/14861
- Clarify documentation of DepthwiseConv2D by @vinhill in https://github.com/keras-team/keras/pull/14817
- add DepthwiseConv1D layer by @fsx950223 in https://github.com/keras-team/keras/pull/14863
- Make model summary wrap by @Llamrei in https://github.com/keras-team/keras/pull/14865
- Update the link in Estimator by @hirobf10 in https://github.com/keras-team/keras/pull/14901
- Fix
int
given forfloat
args by @SamuelMarks in https://github.com/keras-team/keras/pull/14900 - Fix RNN, StackedRNNCells with nested state_size, output_size TypeError issues by @Ending2015a in https://github.com/keras-team/keras/pull/14905
- Fix the use of imagenet_utils.preprocess_input within a Lambda layer with mixed precision by @anth2o in https://github.com/keras-team/keras/pull/14917
- Fix docstrings in
MultiHeadAttention layer
call argumentreturn_attention_scores
. by @guillesanbri in https://github.com/keras-team/keras/pull/14920 - Check if layer has _metrics_lock attribute by @DanBmh in https://github.com/keras-team/keras/pull/14903
- Make keras.Model picklable by @adriangb in https://github.com/keras-team/keras/pull/14748
- Fix typo in docs by @seanmor5 in https://github.com/keras-team/keras/pull/14946
- use getter setter by @fsx950223 in https://github.com/keras-team/keras/pull/14948
- Close _SESSION.session in clear_session by @sfreilich in https://github.com/keras-team/keras/pull/14414
- Fix keras nightly PIP package build. by @copybara-service in https://github.com/keras-team/keras/pull/14957
- Fix EarlyStopping stop at fisrt epoch when patience=0 ; add auc to au… by @DachuanZhao in https://github.com/keras-team/keras/pull/14750
- Add default value in Attention layer docs #50839 by @europeanplaice in https://github.com/keras-team/keras/pull/14952
- Update 00-bug-template.md by @jvishnuvardhan in https://github.com/keras-team/keras/pull/14991
- minor fixing by @slowy07 in https://github.com/keras-team/keras/pull/15008
- Remove cast of y_true to y_pred data type in sparse categorical cross entropy loss by @old-school-kid in https://github.com/keras-team/keras/pull/15015
- Improve a number of error messages in Keras layers. by @copybara-service in https://github.com/keras-team/keras/pull/15031
- Fix typo in the test case name. by @copybara-service in https://github.com/keras-team/keras/pull/15050
- BackupAndRestore callback: Allow the train_counter to be fault tolerant across training interruptions. by @copybara-service in https://github.com/keras-team/keras/pull/15018
- Include Keras API design guidelines in the contribution docs. by @copybara-service in https://github.com/keras-team/keras/pull/15051
- Fix clone_model to consider input_tensors by @LeonhardFeiner in https://github.com/keras-team/keras/pull/14982
- Fix docs about GRU and cuDNN. by @bzamecnik in https://github.com/keras-team/keras/pull/15058
- fix: typo spelling by @slowy07 in https://github.com/keras-team/keras/pull/14989
- update contributing guide by @haifeng-jin in https://github.com/keras-team/keras/pull/15063
- Make python code in Sequential docs consistent by @01-vyom in https://github.com/keras-team/keras/pull/15075
- Create stale.yml by @rthadur in https://github.com/keras-team/keras/pull/15176
- Update Contributing Guide by @haifeng-jin in https://github.com/keras-team/keras/pull/15133
- fix "rbg" -> "rgb" in image_dataset_from_directory by @YoniChechik in https://github.com/keras-team/keras/pull/15177
- Do not initialize tables automatically for lookup layers by @copybara-service in https://github.com/keras-team/keras/pull/15193
- Log the best epoch when restoring the best weights in early stopping by @harupy in https://github.com/keras-team/keras/pull/15197
- update contributing guide by @haifeng-jin in https://github.com/keras-team/keras/pull/15189
- fix array for numpy support by @collinzrj in https://github.com/keras-team/keras/pull/15201
- Add test case for batch normalization with renorm on TPUs. by @copybara-service in https://github.com/keras-team/keras/pull/15234
- Update training.py by @jvishnuvardhan in https://github.com/keras-team/keras/pull/15195
- [Follow-up for #15197] Fix a log message for weight restoration in early stopping by @harupy in https://github.com/keras-team/keras/pull/15222
- Rename references to "K" as "backend" for consistency. by @copybara-service in https://github.com/keras-team/keras/pull/15242
- Add Keras utility for making user programs deterministic. by @copybara-service in https://github.com/keras-team/keras/pull/15243
- Update convolutional.py by @ymodak in https://github.com/keras-team/keras/pull/15158
- Fix for bug causing failing test keras/utils/vis_utils_test.py test_layer_range_value_fail second value (empty list). by @ddrakard in https://github.com/keras-team/keras/pull/15215
- Fix small mistake …
optimizer
tooptimizers
by @MohamedAliRashad in https://github.com/keras-team/keras/pull/15227 - Added dense_shape property delegation by @jackd in https://github.com/keras-team/keras/pull/15199
- handle when a List is used as validation_data instead of a Tuple, in model.fit() by @tarun-bisht in https://github.com/keras-team/keras/pull/15237
- fix cropping layer return empty list if crop is higher than data shape by @arubiales in https://github.com/keras-team/keras/pull/14970
- Make the import in integration_test consistent with other keras code. by @copybara-service in https://github.com/keras-team/keras/pull/15275
- Specify
stacklevel
forwarnings.warn
to make it easier to identify which lines throw warnings by @harupy in https://github.com/keras-team/keras/pull/15209 - Fixes Github tensorflow/issues/51710 by @copybara-service in https://github.com/keras-team/keras/pull/15280
- Print expanded nested layers feature in models.summary() by @krishrustagi in https://github.com/keras-team/keras/pull/15251
- adapt EarlyStopping auto mode to auc by @DachuanZhao in https://github.com/keras-team/keras/pull/15200
- change misleading description of m_mul by @mikael-epigram in https://github.com/keras-team/keras/pull/15288
- The latest update.Hope it can suit you by @DLPerf in https://github.com/keras-team/keras/pull/15295
- Fixed and added ValueError for
plot_model
,model_to_dot
andmodel.summary()
by @krishrustagi in https://github.com/keras-team/keras/pull/15318 - Fix a minor typo in CIFAR-10 and CIFAR-100 description by @Rishit-dagli in https://github.com/keras-team/keras/pull/15321
- Fix cropping2D empty list #15325 by @arubiales in https://github.com/keras-team/keras/pull/15326
- convert label_smoothing dtype to y dtype by @FancyXun in https://github.com/keras-team/keras/pull/15363
- Exclude default bazel paths for VsCode by @bhack in https://github.com/keras-team/keras/pull/15343
- fix: typo in SeparableConv1D by @carmineds in https://github.com/keras-team/keras/pull/15370
- Add user bin path for pip installed packages by @bhack in https://github.com/keras-team/keras/pull/15385
- Fix reset_metrics by @bhack in https://github.com/keras-team/keras/pull/15342
- Kernel_size, pool_size should be positive integers by @WingsBrokenAngel in https://github.com/keras-team/keras/pull/15356
- Reopening #48000, #48491, #48610 from tensorflow/tensorflow by @AdityaKane2001 in https://github.com/keras-team/keras/pull/15315
-
expand_nested
bug fix and changingmodel.summary
style by @krishrustagi in https://github.com/keras-team/keras/pull/15355 - unnecessary casting and condition removed by @cemsina in https://github.com/keras-team/keras/pull/15399
- Bug fix for issue #15211, PR #15233 ("Plot model show activations") by @ddrakard in https://github.com/keras-team/keras/pull/15286
- fix a bug: when use tf.keras.layers.TextVectorization layer to load model by @mikuh in https://github.com/keras-team/keras/pull/15422
- added correct initialisation for MHA by @FabianGroeger96 in https://github.com/keras-team/keras/pull/15423
- Persist attribute "sparse" of IndexLookup layer by @diggerk in https://github.com/keras-team/keras/pull/15473
- Updated Normalization import by @sachinprasadhs in https://github.com/keras-team/keras/pull/15476
- Added layer trainable information in model summary by @mfidabel in https://github.com/keras-team/keras/pull/15459
- Add efficientnet v2 to keras.applications by @sebastian-sz in https://github.com/keras-team/keras/pull/14935
- Fix typos by @kianmeng in https://github.com/keras-team/keras/pull/15543
- Update the contribution guide to include a applications section by @mattdangerw in https://github.com/keras-team/keras/pull/15447
- chore: replace os.path.join with tf.io.gfile.join by @adriangb in https://github.com/keras-team/keras/pull/15551
- Fixing typos. by @MohamadJaber1 in https://github.com/keras-team/keras/pull/15626
- Updating the documentation of MAPE by @sanatmpa1 in https://github.com/keras-team/keras/pull/15604
- Fix typo by @europeanplaice in https://github.com/keras-team/keras/pull/15639
- [Docs] Changed typo ModelNetV3 to MobileNetV3. by @sebastian-sz in https://github.com/keras-team/keras/pull/15640
- Adding a choice not to make batches in
timeseries_dataset_from_array
by @europeanplaice in https://github.com/keras-team/keras/pull/15646 - Bypass the require a config warning for marge layers by @leondgarse in https://github.com/keras-team/keras/pull/15612
- Allow keras.utils.Sequence sub-classes to use sparse/ragged tensors by @karlhigley in https://github.com/keras-team/keras/pull/15264
- fix backend _GRAPH_LEARNING_PHASES graph circular reference. by @zhjunqin in https://github.com/keras-team/keras/pull/15520
- doc: add link to SciKeras migration guide by @adriangb in https://github.com/keras-team/keras/pull/15723
- Fix a minor typo in the docstring by @kykim0 in https://github.com/keras-team/keras/pull/15683
- Fixed docstrings in keras/optimizer_v2/learning_rate_schedule.py by @AdityaKane2001 in https://github.com/keras-team/keras/pull/15718
- Implement compute_output_shape for BaseDenseAttention by @mishc9 in https://github.com/keras-team/keras/pull/15720
- SidecarEvaluator: Graduate from experimental endpoint. by @copybara-service in https://github.com/keras-team/keras/pull/15788
- Update README.md by @aliencaocao in https://github.com/keras-team/keras/pull/15814
New Contributors
- @copybara-service made their first contribution in https://github.com/keras-team/keras/pull/14336
- @jvishnuvardhan made their first contribution in https://github.com/keras-team/keras/pull/14760
- @amogh7joshi made their first contribution in https://github.com/keras-team/keras/pull/14642
- @DavideWalder made their first contribution in https://github.com/keras-team/keras/pull/14804
- @vinhill made their first contribution in https://github.com/keras-team/keras/pull/14817
- @fsx950223 made their first contribution in https://github.com/keras-team/keras/pull/14863
- @Llamrei made their first contribution in https://github.com/keras-team/keras/pull/14865
- @hirobf10 made their first contribution in https://github.com/keras-team/keras/pull/14901
- @SamuelMarks made their first contribution in https://github.com/keras-team/keras/pull/14900
- @Ending2015a made their first contribution in https://github.com/keras-team/keras/pull/14905
- @anth2o made their first contribution in https://github.com/keras-team/keras/pull/14917
- @guillesanbri made their first contribution in https://github.com/keras-team/keras/pull/14920
- @DanBmh made their first contribution in https://github.com/keras-team/keras/pull/14903
- @adriangb made their first contribution in https://github.com/keras-team/keras/pull/14748
- @seanmor5 made their first contribution in https://github.com/keras-team/keras/pull/14946
- @sfreilich made their first contribution in https://github.com/keras-team/keras/pull/14414
- @DachuanZhao made their first contribution in https://github.com/keras-team/keras/pull/14750
- @europeanplaice made their first contribution in https://github.com/keras-team/keras/pull/14952
- @slowy07 made their first contribution in https://github.com/keras-team/keras/pull/15008
- @old-school-kid made their first contribution in https://github.com/keras-team/keras/pull/15015
- @LeonhardFeiner made their first contribution in https://github.com/keras-team/keras/pull/14982
- @01-vyom made their first contribution in https://github.com/keras-team/keras/pull/15075
- @rthadur made their first contribution in https://github.com/keras-team/keras/pull/15176
- @YoniChechik made their first contribution in https://github.com/keras-team/keras/pull/15177
- @harupy made their first contribution in https://github.com/keras-team/keras/pull/15197
- @collinzrj made their first contribution in https://github.com/keras-team/keras/pull/15201
- @ddrakard made their first contribution in https://github.com/keras-team/keras/pull/15215
- @MohamedAliRashad made their first contribution in https://github.com/keras-team/keras/pull/15227
- @jackd made their first contribution in https://github.com/keras-team/keras/pull/15199
- @tarun-bisht made their first contribution in https://github.com/keras-team/keras/pull/15237
- @arubiales made their first contribution in https://github.com/keras-team/keras/pull/14970
- @krishrustagi made their first contribution in https://github.com/keras-team/keras/pull/15251
- @mikael-epigram made their first contribution in https://github.com/keras-team/keras/pull/15288
- @DLPerf made their first contribution in https://github.com/keras-team/keras/pull/15295
- @Rishit-dagli made their first contribution in https://github.com/keras-team/keras/pull/15321
- @FancyXun made their first contribution in https://github.com/keras-team/keras/pull/15363
- @bhack made their first contribution in https://github.com/keras-team/keras/pull/15343
- @carmineds made their first contribution in https://github.com/keras-team/keras/pull/15370
- @WingsBrokenAngel made their first contribution in https://github.com/keras-team/keras/pull/15356
- @AdityaKane2001 made their first contribution in https://github.com/keras-team/keras/pull/15315
- @cemsina made their first contribution in https://github.com/keras-team/keras/pull/15399
- @mikuh made their first contribution in https://github.com/keras-team/keras/pull/15422
- @FabianGroeger96 made their first contribution in https://github.com/keras-team/keras/pull/15423
- @diggerk made their first contribution in https://github.com/keras-team/keras/pull/15473
- @sachinprasadhs made their first contribution in https://github.com/keras-team/keras/pull/15476
- @mfidabel made their first contribution in https://github.com/keras-team/keras/pull/15459
- @sebastian-sz made their first contribution in https://github.com/keras-team/keras/pull/14935
- @kianmeng made their first contribution in https://github.com/keras-team/keras/pull/15543
- @MohamadJaber1 made their first contribution in https://github.com/keras-team/keras/pull/15626
- @sanatmpa1 made their first contribution in https://github.com/keras-team/keras/pull/15604
- @leondgarse made their first contribution in https://github.com/keras-team/keras/pull/15612
- @karlhigley made their first contribution in https://github.com/keras-team/keras/pull/15264
- @zhjunqin made their first contribution in https://github.com/keras-team/keras/pull/15520
- @kykim0 made their first contribution in https://github.com/keras-team/keras/pull/15683
- @mishc9 made their first contribution in https://github.com/keras-team/keras/pull/15720
- @aliencaocao made their first contribution in https://github.com/keras-team/keras/pull/15814
Full Changelog: https://github.com/keras-team/keras/compare/v2.7.0-rc0...v2.8.0-rc0