MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / _check_drag_actions_match

Function _check_drag_actions_match

eval/utils/action_utils.py:214–232  ·  view source on GitHub ↗

Determines if two drag actions are the same.

(
    drag_1_touch_yx,
    drag_1_lift_yx,
    drag_2_touch_yx,
    drag_2_lift_yx,
)

Source from the content-addressed store, hash-verified

212
213
214def _check_drag_actions_match(
215 drag_1_touch_yx,
216 drag_1_lift_yx,
217 drag_2_touch_yx,
218 drag_2_lift_yx,
219):
220 """Determines if two drag actions are the same."""
221 # Store drag deltas (the change in the y and x coordinates from touch to
222 # lift), magnitudes, and the index of the main axis, which is the axis with
223 # the greatest change in coordinate value (e.g. a drag starting at (0, 0) and
224 # ending at (0.3, 0.5) has a main axis index of 1).
225 drag_1_deltas = drag_1_lift_yx - drag_1_touch_yx
226 drag_1_magnitudes = jnp.abs(drag_1_deltas)
227 drag_1_main_axis = np.argmax(drag_1_magnitudes)
228 drag_2_deltas = drag_2_lift_yx - drag_2_touch_yx
229 drag_2_magnitudes = jnp.abs(drag_2_deltas)
230 drag_2_main_axis = np.argmax(drag_2_magnitudes)
231
232 return jnp.equal(drag_1_main_axis, drag_2_main_axis)
233
234
235def check_actions_match(

Callers 1

check_actions_matchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected