-
Notifications
You must be signed in to change notification settings - Fork 19.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ArrayDataAdapter no longer converts to NumPy and supports sparse tens…
…ors. (#19298) Instead, the passed arrays can be sliced or indexed in their native format. - This addresses #18408 and improves performance, especially with Tensorflow and Torch. It improves TF -> TF and Torch -> Torch, but also TF -> Torch and Torch -> TF. - This allows the support of sparse tensors (`tf.SparseTensor`, `jax.experimental.sparse.BCOO` and `scipy.sparse`). These sparse tensors are sliced as sparse and the iterators yield sparse tensors in the requested format (either TF or JAX). - The `validation_split` argument of `Model.fit()` can now be used with anything supported by `ArrayDataAdapter`, in particular, sparse tensors are now supported. In summary, `ArrayDataAdapter` now supports: - native Python arrays - NumPy arrays - Tensorflow tensors, ragged tensors, sparse tensors (new) - JAX arrays and BCOO sparse tensors (new) - pandas DataFrames - pandas Series - scipy sparse matrices (new) Also: - Fixed bug where batch level shuffling would shuffle inconsistently the different arrays (in particular inputs and labels) when using a TF dataset or a NumPy iterator. - Fixed bug where `tf.RaggedTensor`s would only work when using a TF dataset. - Fixed bug where `tf.RaggedTensor`s would not work when doing batch level shuffling. - Added a workaround for a bug where `tf.cast`ing a `tf.SparseTensor` would lose the static shape. - Added test coverage for `tf.RaggedTensor`s and `pandas.Series`. - Added verification in tests that inputs and labels are shuffled consistently.
- Loading branch information
Showing
12 changed files
with
800 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.