numpy_ix.py 781 B

12345678910111213141516171819202122232425
  1. from evaluator import *
  2. DESCRIPTION = "Test if a model can identify the _ix function as a method for simplifying some code."
  3. TAGS = ['explain', 'python']
  4. question = '''I want to vectorize a function
  5. frame = np.zeros((out_h, out_w, 3), dtype=np.uint8)
  6. for i, val1 in enumerate(rows):
  7. for j, val2 in enumerate(cols):
  8. for j, val3 in enumerate(ch):
  9. # Assuming you want to store the pair as tuples in the matrix
  10. frame[i, j, k] = image[val1, val2, val3]
  11. out.write(np.array(frame))
  12. with a simple numpy function that does something like this what is it called'''
  13. TestNumpyIx = question >> LLMRun() >> SubstringEvaluator("ix_")
  14. if __name__ == "__main__":
  15. print(run_test(TestNumpyIx))