0.11.1
68
i am currently trying to grap a few values from a tensor using Tensor.data() witch takes a lot of time given a large tensor.
const mask=tf.where(......)
const all_indices = tf.range(1,N+1,1"int32");
//starting at 1 to prevent 0x0
const indices = mask.toInt().mul(all_indices)
const indicesArr = Array.from(await Indices.data()).filter(i => i > 0).map(i => i - 1)
const final = tf.gather(data, tf.tensor1d(indicesArr,"int32"))
i am the wondering when or if the python equivalent tf.boolean_mask will be implemented
# 1-D example
tensor = [0, 1, 2, 3]
mask = np.array([True, False, True, False])
boolean_mask(tensor, mask) # [0, 2]
What is the current progress?
@dsmilkov
Most helpful comment
What is the current progress?
@dsmilkov