MCPcopy Create free account
hub / github.com/microsoft/Magma / denormalize_actions

Function denormalize_actions

server/main.py:48–60  ·  view source on GitHub ↗

Convert normalized actions (-1 to 1) to actual values using the specified range

(
    normalized_actions,
    action_low=np.array([-0.05, -0.05, -0.05, -3.14, -3.14, -3.14, 0]),
    action_high=np.array([0.05, 0.05, 0.05, 3.14, 3.14, 3.14, 1]),
)

Source from the content-addressed store, hash-verified

46
47
48def denormalize_actions(
49 normalized_actions,
50 action_low=np.array([-0.05, -0.05, -0.05, -3.14, -3.14, -3.14, 0]),
51 action_high=np.array([0.05, 0.05, 0.05, 3.14, 3.14, 3.14, 1]),
52):
53 """Convert normalized actions (-1 to 1) to actual values using the specified range"""
54 mask = np.ones_like(normalized_actions, dtype=bool)
55 raw_action = np.where(
56 mask,
57 0.5 * (normalized_actions + 1) * (action_high - action_low) + action_low,
58 normalized_actions,
59 )
60 return raw_action
61
62
63def generate_response(image, user_prompt):

Callers 1

generate_responseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected