Reputation: 674
I'm using the following code to add tensor with scalar as follows,
self.seen = tf.compat.v1.assign_add(self.seen , 1.)
Unfotunately it throws the following error,
> ValueError: Operation name: "AssignAddVariableOp" op:
> "AssignAddVariableOp" input: "AssignAddVariableOp/Variable" input:
> "Const" attr { key: "dtype" value {
> type: DT_FLOAT } } is not an element of this graph.
what am I missing?
Upvotes: 0
Views: 89
Reputation: 3764
According to Tensorflow docs,
Unlike tf.math.add, this op does not broadcast. ref and value must have the same shape.
So you can't use this to add scalars and tensors.
Upvotes: 1