tinygrad / tinygrad

You like pytorch? You like micrograd? You love tinygrad! ❤️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggested code improvement

yonatan895 opened this issue · comments

I noticed that In the kernel.py file (in /tinygrad/codgen, line 49), a list is being created in memory while it doesn't have to be, like this:

for tc_dim in [i for i in range(2) if axes_exist[i]]

Why can't it just be with () instead of []:

for tc_dim in (i for i in range(2) if axes_exist[i])

I just went through the code from my phone and found it peculiar (although of course the performance diff is neglegble as there are only two runs)

if you profile it and find significant diff in speed or mem usage we are happy to change, and would like to find a way to enforce it

often time it's negligible and python version dependent so not really worth it