[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TF 2.0] tf.summary step argument should cast to int64 #26407

Open
nfelt opened this issue Mar 6, 2019 · 5 comments
Open

[TF 2.0] tf.summary step argument should cast to int64 #26407

nfelt opened this issue Mar 6, 2019 · 5 comments
Assignees
Labels
comp:tensorboard Tensorboard related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.7 Issues related to TF 2.7.0 type:bug Bug

Comments

@nfelt
Copy link
Contributor
nfelt commented Mar 6, 2019

The TF 2.0 versions of tf.summary.scalar(), image(), etc now require a step argument at the callsite. This step argument should allow at least any integral type and probably also floating point types (at least if they have no fractional part), but it currently requires a python integer or a tf.int64 tensor.

This results in errors like:

tf.summary.scalar('foo', 22, step=tf.constant(1))
...
ValueError: Tensor conversion requested dtype int64 for Tensor with dtype int32: 'tf.Tensor(1, shape=(), dtype=int32)'
tf.summary.scalar('foo', 22, step=1.0)
...
TypeError: Cannot convert provided value to EagerTensor. Provided value: 1.0 Requested dtype: int64
@nfelt nfelt added comp:tensorboard Tensorboard related issues type:bug Bug TF 2.0 Issues relating to TensorFlow 2.0 labels Mar 6, 2019
@nfelt nfelt self-assigned this Mar 6, 2019
@shashvatshahi1998
Copy link
Contributor
shashvatshahi1998 commented Apr 3, 2019

please can i contribute to this @nfelt. Can you guide me

@mohantym
Copy link
Contributor

Hi @nfelt! This issue seems to be resolved in latest stable version TF 2.6 , Attaching Gist for reference.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@nfelt nfelt reopened this Oct 11, 2021
@nfelt
Copy link
Contributor Author
nfelt commented Oct 11, 2021

No, this isn't resolved. The error won't happen unless a summary is actually written, which requires that there be a summary writer enabled. I omitted that from the issue description for brevity, but here is a complete repro in TF 2.6:

import tensorflow as tf
with tf.summary.create_file_writer("/tmp/foo").as_default():
    # Raises ValueError: Tensor conversion requested dtype int64 for Tensor with dtype int32: <tf.Tensor: shape=(), dtype=int32, numpy=1>
    tf.summary.scalar('foo', 22, step=tf.constant(1))
with tf.summary.create_file_writer("/tmp/foo").as_default():
    # Raises TypeError: Cannot convert 1.0 to EagerTensor of dtype int64
    tf.summary.scalar('foo', 22, step=1.0)

@kumariko kumariko added stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.7 Issues related to TF 2.7.0 and removed TF 2.0 Issues relating to TensorFlow 2.0 labels Dec 13, 2021
@pjpratik
Copy link
Contributor
pjpratik commented Dec 20, 2022

I was able to reproduce this issue in TF Nightly 2.14.0-dev20230724. Please find the gist here. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:tensorboard Tensorboard related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.7 Issues related to TF 2.7.0 type:bug Bug
Projects
None yet
Development

No branches or pull requests

5 participants