-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
TensorFlow.js version
0.11.1
Browser version
68
Describe the problem or feature request
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]Code to reproduce the bug / link to feature request
justadudewhohacks, pilczuk, zqingr, patrikohlsson, paapu88 and 3 morezqingr