Given a tensor of values with dimensions [batch, values], I need to get the minimum value that occurs before the maximum value. Thus, this naive approach:
value_max, value_max_idx = data.max(dim=1)
value_min_before_max, _ = data[:value_max_idx + 1].min(dim=1)

This obviously didn’t work as the slice is a tensor of dimension [batch]. But I feel like there should be a simple answer here… anyone have a good idea?