Skip to content

ValueError while passing a SparseTensor input to the Dense layer. #35013

@rishabh-shrivastava

Description

@rishabh-shrivastava

System information

  • OS Platform and Distribution: MacOS Mojave
  • TensorFlow installed from: conda install tensorflow
  • TensorFlow version: 2.0.0
  • Python version: 3.6

I have generated a smaller version of my issue:

from tensorflow.keras import layers
inputs = layers.Input(shape=(256,), sparse=False, name='name_sparse')
x = layers.Dense(32, name="my_layer")(inputs)
print(x)

Output
Tensor("my_layer/Identity:0", shape=(None, 32), dtype=float32)

But if I change sparse=True, I get a ValueError:
The last dimension of the inputs to Dense should be defined. Found None.

Other info / logs
I am able to run it on TF1.14 with Keras 2.2.4.

Metadata

Metadata

Labels

TF 2.0Issues relating to TensorFlow 2.0comp:kerasKeras related issuestype:supportSupport issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions