Skip to content

Commit

Permalink
Remove dependency on eval_saved_model from slice_accessor_test.py.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 685836546
  • Loading branch information
zhouhao138 authored and tfx-copybara committed Oct 14, 2024
1 parent 851e847 commit c8b5fbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fixes a bug by ensuring feature values are always numpy arrays.
* Modifies a ROUGE Test to be compatible with NumPy v2.0.1.
* Remove keras_util_test.py which is based on estimator models.
* Remove dependency on eval_saved_model encodings.

## Breaking Changes

Expand Down
23 changes: 7 additions & 16 deletions tensorflow_model_analysis/slicer/slice_accessor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import pyarrow as pa
import tensorflow as tf
from tensorflow_model_analysis.api import types
from tensorflow_model_analysis.eval_saved_model import encoding
from tensorflow_model_analysis.slicer import slice_accessor

_ENCODING_NODE_SUFFIX = 'node'


class SliceAccessorTest(tf.test.TestCase, parameterized.TestCase):

Expand Down Expand Up @@ -78,21 +79,11 @@ def testLegacyAccessFeaturesDict(self):
) = sess.run(
fetches=[sparse, dense, dense_single, dense_multidim, squeeze_needed])
features_dict = {
'sparse': {
encoding.NODE_SUFFIX: sparse_value
},
'dense': {
encoding.NODE_SUFFIX: dense_value
},
'dense_single': {
encoding.NODE_SUFFIX: dense_single_value
},
'squeeze_needed': {
encoding.NODE_SUFFIX: squeeze_needed_value
},
'dense_multidim': {
encoding.NODE_SUFFIX: dense_multidim_value
},
'sparse': {_ENCODING_NODE_SUFFIX: sparse_value},
'dense': {_ENCODING_NODE_SUFFIX: dense_value},
'dense_single': {_ENCODING_NODE_SUFFIX: dense_single_value},
'squeeze_needed': {_ENCODING_NODE_SUFFIX: squeeze_needed_value},
'dense_multidim': {_ENCODING_NODE_SUFFIX: dense_multidim_value},
}
accessor = slice_accessor.SliceAccessor([features_dict])
self.assertEqual([b'apple', b'banana'], accessor.get('sparse'))
Expand Down

0 comments on commit c8b5fbd

Please sign in to comment.