Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions code_to_optimize/code_directories/simple_tracer_e2e/workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ def __init__(self, num_classes=1000):

def forward(self, x):
features = self._extract_features(x)

output = self._classify(features)
return output

def _extract_features(self, x):
result = []
for i in range(len(x)):
pass

return result
# No need to loop, just return an empty list
return []

def _classify(self, features):
# Compute the sum and modulo just once, then construct the result list efficiently
Expand Down Expand Up @@ -65,7 +61,8 @@ def test_models():

@lru_cache(maxsize=1001) # One possible input per [0, 1000]
def _cached_joined(number):
return " ".join(str(i) for i in range(number))
# Use map for slightly faster integer-to-string conversion and joining
return " ".join(map(str, range(number)))


if __name__ == "__main__":
Expand Down
Loading