Im using Tensorflow 1.13. However I get an error saying that I can't iterate through a tensor unless I'm in eager mode. Is there a way of doing this without going into eager mode?
with tf.Session(config=config) as sess:
context = tf.placeholder(tf.int32, [args.batch_size, None])
mask = tf.placeholder(tf.int32, [args.batch_size, 2])
output = model.model(hparams=hparams, X=context)
for batch_index in range(args.batch_size):
start = mask[batch_index][0]
end = mask[batch_index][1]
for i in range(start, end+1):
output['logits'][batch_index, i , context[batch_index,i]].assign(math.inf)
loss = tf.reduce_mean(
tf.nn.sparse_softmax_cross_entropy_with_logits(
labels=context[:, 1:], logits=output['logits'][:, :-1]))