Skip to content

Commit

Permalink
Add support for feature extraction on list outputs in addition to np.…
Browse files Browse the repository at this point in the history
…ndarray and empty lists.

PiperOrigin-RevId: 329956465
  • Loading branch information
mdreves authored and tf-model-analysis-team committed Sep 3, 2020
1 parent b1e47da commit 9c07f41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tensorflow_model_analysis/extractors/feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ def _AugmentExtracts(data: Dict[Text, Any], prefix: Text, excludes: List[bytes],
extracts[col_name] = types.MaterializedColumn(
name=col_name, value=val.values)

elif isinstance(val, np.ndarray):
val = val[0] # only support first dim for now.
elif isinstance(val, np.ndarray) or isinstance(val, list):
# Only support first dim for now
val = val[0] if len(val) > 0 else [] # pylint: disable=g-explicit-length-test
extracts[col_name] = types.MaterializedColumn(name=col_name, value=val)

else:
Expand Down

0 comments on commit 9c07f41

Please sign in to comment.