Skip to content

tf.variable with initial value does not work in eager mode #155

Description

@rnett

As the title says, tf.variable with an initial value does not work in eager mode. I'm not sure if it is supposed to, as tf.Variable does in the python api but apparently didn't at first. Interestingly, it's not the variable op that fails, it's the assign:

cannot compute Assign as input #0(zero-based) was expected to be a int32_ref tensor but is a int32 tensor
org.tensorflow.exceptions.TFInvalidArgumentException: cannot compute Assign as input #0(zero-based) was expected to be a int32_ref tensor but is a int32 tensor
	at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:87)
	at org.tensorflow.EagerOperationBuilder.execute(EagerOperationBuilder.java:273)
	at org.tensorflow.EagerOperationBuilder.build(EagerOperationBuilder.java:66)
	at org.tensorflow.EagerOperationBuilder.build(EagerOperationBuilder.java:55)
	at org.tensorflow.op.core.Assign.create(Assign.java:97)
	at org.tensorflow.op.core.Helpers.createVariableWithInit(Helpers.java:51)
	at org.tensorflow.op.Ops.variable(Ops.java:7520)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions