Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it not very accurate to use the size reward of the entire file as the reward for each caller-callee feature, if the file is large and has a large number of caller-callee? #325

Open
18liumin opened this issue Dec 12, 2023 · 1 comment

Comments

@18liumin
Copy link

def _overwrite_trajectory_reward(sequence_example: tf.train.SequenceExample,
reward: float) -> tf.train.SequenceExample:
"""Overwrite the reward in the trace (sequence_example) with the given one.

Args:
sequence_example: A tf.SequenceExample proto describing compilation trace.
reward: The reward to overwrite with.

Returns:
The tf.SequenceExample proto after post-processing.
"""
sequence_length = len(
next(iter(sequence_example.feature_lists.feature_list.values())).feature)

reward_list = sequence_example.feature_lists.feature_list['reward']
for _ in range(sequence_length):
added_feature = reward_list.feature.add()
added_feature.float_list.value.append(reward)

return sequence_example

@mtrofin
Copy link
Collaborator

mtrofin commented Dec 18, 2023

Notice the discount factor is 1, which should mean only one of the reward values would be picked. It's probably superfluous we set the others to be the same, and hurts readability (clearly) - makes for easier experimentation with other discount values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants