In Tensorflow, I would like to create a mask of all ones, except a single element, where the element location is chosen randomly. Specifically, I would like to create a random mask of either [0,1,1,1] or [1,1,0,1]
I tried:
import tensorflow as tf
import numpy as np
# randomly draw the column to select (either column 0 or 2)
COLselect = tf.to_int64(tf.greater(tf.random_uniform((1,)), 0.5))
column_num = COLselect*2
ones_mask = tf.Variable(numpy.ones((4,)))
And I am stuck on how to create a new mask that nulls column_num column of ones_mask.
I tried following Manipulating matrix elements in tensorflow, but failed because the column is a tensor.
Thanks