question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError in the tutorial on Colab environment

See original GitHub issue

Hello

The ValueError error Insufficient elements in branch_graphs[0].outputs. is found in both Neural Graph Learning tutorials (sentiment and document classification).

Both happen during the training of graph_reg_model.fit() process. The error messages are shown below, I think it is due to the same issue.

  • Graph regularization for document classification using natural graphs
Epoch 1/100
      1/Unknown - 0s 303ms/step

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-20-0c7d19de6181> in <module>()
     10     loss='sparse_categorical_crossentropy',
     11     metrics=['accuracy'])
---> 12 graph_reg_model.fit(train_dataset, epochs=HPARAMS.train_epochs, verbose=1)

25 frames

/tensorflow-2.1.0/python3.6/tensorflow_core/python/ops/cond_v2.py in _make_indexed_slices_indices_types_match(op_type, branch_graphs)
    650                      "Expected: %i\n"
    651                      "Actual: %i" %
--> 652                      (current_index, len(branch_graphs[0].outputs)))
    653 
    654   # Cast indices with mismatching types to int64.

ValueError: Insufficient elements in branch_graphs[0].outputs.
Expected: 11
Actual: 10
  • Graph regularization for sentiment classification using synthesized graphs
Epoch 1/10
      1/Unknown - 2s 2s/step

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-30-e49eed0ffe51> in <module>()
      3     validation_data=validation_dataset,
      4     epochs=HPARAMS.train_epochs,
----> 5     verbose=1)

25 frames

/tensorflow-2.1.0/python3.6/tensorflow_core/python/ops/cond_v2.py in _make_indexed_slices_indices_types_match(op_type, branch_graphs)
    650                      "Expected: %i\n"
    651                      "Actual: %i" %
--> 652                      (current_index, len(branch_graphs[0].outputs)))
    653 
    654   # Cast indices with mismatching types to int64.

ValueError: Insufficient elements in branch_graphs[0].outputs.
Expected: 18
Actual: 17

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
basirshariatcommented, Mar 25, 2020

I upgraded to 2.2.0rc1 and i get this error when the fit of the base model is called:

/python3.7/site-packages/tensorflow/python/keras/engine/input_spec.py:216 assert_input_compatibility ’ but received input with shape ’ + str(shape))

ValueError: Input 0 of layer dense is incompatible with the layer: expected axis -1 of input shape to have value 1433 but received input with shape [None, 1]
0reactions
arjungcommented, May 7, 2020

This should no longer be an issue since TF 2.2.0 has been released. Sorry about the version complications, things will be much simpler now.

https://github.com/tensorflow/neural-structured-learning/commit/edead04aa3be59f07baea52fc2cf22c320cdaff5 updates the neural graph learning tutorials to use the default TF version in colab.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue in tensorflow 2 google colab tutorial - Stack Overflow
Issue in tensorflow 2 google colab tutorial ... ValueError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on ...
Read more >
Google Colab 101 Tutorial with Python — Tips, Tricks, and FAQ
An in-depth tutorial on how to use Google Colab with Python, along with Colab's tips, tricks, and FAQ.
Read more >
Build, train and evaluate models with TensorFlow Decision ...
In this tutorial, you will learn how to: Train a binary classification Random Forest on a dataset containing numerical, categorical and ...
Read more >
Learning the CoLab Jupyter Notebook Environment
In this tutorial, you will learn about the main features of the Google CoLab REPL. Part 1 – Access the CoLab Environment and...
Read more >
TF-Agents Environments Tutorial.ipynb - Colaboratory
In TF-Agents, environments can be implemented either in Python or TensorFlow. ... raise ValueError('`action` should be 0 or 1.') if self.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found