tensorflow / tensorflow/transform

scale_to_z_score_per_key does not work with SparseTensors and key_vocabulary_filename is not None

Open
#250 1 comment 1 reaction 1 assignee View on GitHub

@zoyahav is already working on this.

Since Nov 18, 2021.

stat:contributions welcome type:bug
Dominant language
Python
Stars
989
Forks
225
PR merge metrics
No merged PRs in 30d

Description

If you try to run tft.scale_to_z_score_per_key while passing in SparseTensors for x and key, while also setting key_vocabulary_filename to a value other than None, you will get an error message like:

TypeError: Expected string, got <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x1a7d5e9a0> of type 'SparseTensor' instead.

This exception ultimately originates from here:

https://github.com/tensorflow/transform/blob/v1.3.0/tensorflow_transform/tf_utils.py#L649

The root cause is that key is a SparseTensor instead of a regular Tensor (key.values needs to be passed in instead of key)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.