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:
cannotcomputeAssignasinput #0(zero-based) wasexpectedtobeaint32_reftensorbutisaint32tensororg.tensorflow.exceptions.TFInvalidArgumentException: cannotcomputeAssignasinput #0(zero-based) wasexpectedtobeaint32_reftensorbutisaint32tensoratorg.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:87)
atorg.tensorflow.EagerOperationBuilder.execute(EagerOperationBuilder.java:273)
atorg.tensorflow.EagerOperationBuilder.build(EagerOperationBuilder.java:66)
atorg.tensorflow.EagerOperationBuilder.build(EagerOperationBuilder.java:55)
atorg.tensorflow.op.core.Assign.create(Assign.java:97)
atorg.tensorflow.op.core.Helpers.createVariableWithInit(Helpers.java:51)
atorg.tensorflow.op.Ops.variable(Ops.java:7520)
As the title says,
tf.variablewith an initial value does not work in eager mode. I'm not sure if it is supposed to, astf.Variabledoes in the python api but apparently didn't at first. Interestingly, it's not the variable op that fails, it's the assign: