How to assgin element value according to its index in tensorflow? -
for in range shape(l)[0]: l[i,:,:,:,0] = j in range shape(l)[2]: l[:,:,j,:,1] = j for example, if want implement piece of code above:
(actually, tend usetf.gather therefore need create index)
what type of l? if it's tensor have pass through tf.py_func function (i think it's best option since allow treat tensor object numpy.array , it's trivial) cf :
https://www.tensorflow.org/api_docs/python/tf/py_func
else seems complicated cf :
Comments
Post a Comment