'Applies a penalty for playing notes not in a specific key.
Args:
action: One-hot encoding of the chosen action.
penalty_amount: The amount the model will be penalized if it plays
a note outside the key.
key: The numeric values of notes belonging to this key. Defaults to
C-major if not provided.
Returns:
Float reward value.'

def reward_key(self, action, penalty_amount=(-1.0), key=None):

    if (key is None):
        key = rl_tuner_ops.C_MAJOR_KEY
    reward = 0
    action_note = np.argmax(action)
    if (action_note not in key):
        reward = penalty_amount
    return reward
