0

Here's part of the code I am using:

noise = tf.Variable(tf.zeros((299, 299, 3)))
sess.run(noise.initializer)
op1 = tf.assign(subX,x_hat-x)
op3 = tf.assign(noise[125:175, 125:175], subX)
op2 = tf.assign(x_hat,noise+x)

As you can see, for op3, I am trying to assign part of the Variable "noise" from subX, which is determined by. However, I am getting this error:

UnimplementedError: 2 root error(s) found. (0) Unimplemented: sliced l-value shape [50,50,3] does not match r-value shape [299,299,3]. Automatic broadcasting not yet implemented. [[node strided_slice_2/_assign (defined at :10) ]] [[Assign_15/_821]] (1) Unimplemented: sliced l-value shape [50,50,3] does not match r-value shape [299,299,3]. Automatic broadcasting not yet implemented.
[[node strided_slice_2/_assign (defined at :10) ]] 0 successful operations. 0 derived errors ignored.

Errors may have originated from an input operation. Input Source operations connected to node strided_slice_2/_assign: Variable/read (defined at :7) Variable_5 (defined at :7)

Input Source operations connected to node strided_slice_2/_assign: Variable/read (defined at :7)
Variable_5 (defined at :7)

JobHunter69
  • 1,706
  • 5
  • 25
  • 49
  • Possible duplicate of [How to do slice assignment in Tensorflow](https://stackoverflow.com/questions/39157723/how-to-do-slice-assignment-in-tensorflow). – giser_yugang Jul 11 '19 at 01:55

1 Answers1

0

I made a simple mistake on this line:

op3 = tf.assign(noise[125:175, 125:175], subX)

subX is a different size from noise; a bit hard to infer since I didn't add it within the details.

JobHunter69
  • 1,706
  • 5
  • 25
  • 49