tensorflow / tensorflow/probability

Difference returning dtype of tfp.layers.IndependentNormal.params_size on Windows and Google Colab (Linux )

Open
#1,080 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

layers
Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I found the following alike example from the document of TensorFlow probability.

model = tf.keras.Sequential([
    tfp.layers.DenseFlipout(800, activation=tf.nn.tanh),
    tfp.layers.DenseFlipout(tfp.layers.IndependentNormal.params_size(1)), # This line raise InvalidArgumentError (Original exception throw from tf.concat function.)
    # tfp.layers.DenseFlipout(np.int32(tfp.layers.IndependentNormal.params_size(1))), # This line is working both environments.
    tfp.layers.IndependentNormal(1)
])

The example is working on Windows but it is NOT working on Google Colab (Linux) by the eager execution.
The problem function is tfp.layers.IndependentNormal.params_size.
This return dtype is int32 on Windows but it is int64 on Google Colab (Linux),

Is this problem well known or unknown?
Or my usage is wrong?
I seem correct behavior is the Windows environment because of the "int" type will interpret "int32" on the numpy.

I made a small example, please verify the usage and the problem.
https://gist.github.com/elda27/54989bb20383ae29dc981bf36bb29a73

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.

Research direction

Start with the linked gist and the tfp.layers.IndependentNormal.params_size entry point, then reproduce the dtype difference in the Windows and Google Colab environments described. Done means the platform-dependent result is resolved or clearly documented, with the provided model example behaving consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.