Use tf functions instead of for loops tensorflow to get slice/mask
问题 I have 2 tensors, my prediction tensor pred is of shape [batch, rows, cols, depth, vals] or [32, 40, 60, 2, 2] . My ground truth tensor y is shape [batch, num_objs, vals] or [32, 4, 10] . The y tensor has values that correspond to a slice of the pred tensor. I get the indexes using true_grid_coords = (y[:,:,:2] // params.grid_stride) Now I want to create a mask with the same shape as my pred tensor using the vals from true_grid_coords . I want something like [batch, rows, cols, depth, vals] =