3 ms·
I'm sorry to have offended you, but I don't feel personal insults over the README of an open source project are particularly reasonable. This affects the actua
by striking 5y ago
I'm sorry to have offended you, but I don't feel personal insults over the README of an open source project are particularly reasonable.
This affects the actual code, too! See, for example, https://github.com/geohot/tinygrad/commit/cfb7a4c41a2b6bcc0953a35cb29629561720cfd1 https://github.com/geohot/tinygrad/commit/cfb7a4c41a2b6bcc09..., which includes this gem:
diff --git a/tinygrad/ops/ops_cpu.py b/tinygrad/ops/ops_cpu.py
index a454f56f..0686f810 100644
--- a/tinygrad/ops/ops_cpu.py
+++ b/tinygrad/ops/ops_cpu.py
@@ -2,22 +2,15 @@
from ..tensor import Function
class CPUBuffer(np.ndarray):
- def log(x):
- return np.log(x)
- def exp(x):
- return np.exp(x)
- def relu(x):
- return np.maximum(x, 0)
- def expand(x, shp):
- return np.broadcast_to(x, shp)
+ log = lambda x: np.log(x)
+ exp = lambda x: np.exp(x)
+ relu = lambda x: np.maximum(x, 0)
+ expand = lambda x,shp: np.broadcast_to(x, shp)
+ permute = lambda x,order: x.transpose(order)
+ type = lambda x,tt: x.astype(tt)
+ custompad = lambda x,padding: np.pad(x, padding)
def amax(x, *args, **kwargs):
return np.amax(x, *args, **kwargs)
- def permute(x, order):
- return x.transpose(order)
- def type(x, tt):
- return x.astype(tt)
- def custompad(x, padding):
- return np.pad(x, padding)
def toCPU(x):
return x
@staticmethod
The "actual code" is being golfed for no other reason than to keep the line count down, for the sake of a promise that never needed to be made. This commit recovered a total of seven lines wherein new code can be added, in exchange for readability. It is not just a quirk, not just some sort of interesting aside like one could argue for suckless' `dwm`: this promise actively makes the code worse over time, for no reason.
- recuter 5y agoNo offense taken and no offense intended at all friend. In my opinion we are down the rabbit hole of arguing style over substance. I just think you are grasping at straws. Tools like black (if there was a just god it would just be part of the language, like gofmt) can easily settle stylistic choices. Really not worth endlessly debating, what next, tabs vs spaces? This commit seems fine to me as well. Consider the golfing serves the purpose of "the lols" if you must. Heck this particular commit looks slightly better with the change! Excessive golfing to the detriment of code quality over time is a well known and wholly irrelevant point to make with something like Tinygrad. If you are so convinced of what you are saying, fork and rewrite it as verbosely as you prefer and demonstrate some significant improvement to the project quality. Would be insightful.
- striking 5y agoI think I've proven my point well enough here by making it clear that in order for them to stay under 1kLOC they have had to make golfing-style changes that cannot be automated. If I were hell-bent on convincing you, I could fork their repo and add literally any feature requiring more than ten LOC and win. They would have to bend over backwards to get enough lines back to be able to merge whatever it is I wrote, with exponentially worse effects per individual line contributed. But I'm not hell-bent on convincing you. You know that I'm not actually going to write code for you. You might think it's a clever rhetorical strategy, but it's not. Because I have other things to do, like a day job and personal projects, whose preemption of my jumping through your hoop are completely disconnected from the veracity of my line of reasoning.
- recuter 5y agoThat's just like, your opinion, man. And it isn't a rhetorical strategy. It is socratic questioning. Should you sit down and attempt to write something out of spite (an excellent motivator, as good as any) it would go slightly differently than how you theorize. In order to add a feature requiring more than ten LOC you'd actually have to come up with one in the first place :) That would require reading Tinygrad, which shouldn't take very long for obvious reasons. Probably we've been arguing about this for longer. At which point you'd realize there is not much to add to it and you are splitting hairs over whether it is 1200 lines or 999 lines. In which case you could just run black on it and leave it at whatever line count it spits out. That wouldn't even require any additional coding on your part! Then you can compare the black'd version to theirs and realize they made a very very small sacrifice as a lark. Thereby finally understanding the difference between the principal of "code golf bad" and the reality of "tinygrad l33t demo" you ol' fuddy duddy.
- striking 5y agoSocratic questioning involves questioning, not unexplained assertions. You definitely don't come off as a modern-day Socrates when you use the latter. I'm not against something like a 64k or 4k intro competition, because the results are generally that you get to see someone take advantage of every inch of their machine, like in https://linusakesson.net/scene/a-mind-is-born/ https://linusakesson.net/scene/a-mind-is-born/, filing down an executable byte by byte until it does what they wanted it to do. That's rad as hell. The results here are that... someone has filed down their Python program in a way that makes it smaller. Not even in number of bytes, just in number of lines. In a really uninteresting way. It's not even like the Python examples on StackExchange's codegolf in that sense, because we could go the complete opposite route and merge most of these statements together with semicolons. It doesn't become more interesting as it gets smaller, or less interesting as it gets bigger. It's the same program regardless of how many lines it occupies, which makes it that much less interesting. So, yes, to some extent we agree, you can just run this through automated tools and it will be as many or as few lines as you like. I see that as pointless because other restrictions would be much more stimulating, and not restricting yourself so heavily would probably lead to better (or at least more legible) results. But sure, that'll just be this fuddy duddy's opinion.
- a-dub 5y agoi think it's an improvement. there's nothing wrong with functional style.
- cma 5y agoIt could be written: def log(x): return np.log(x) def exp(x): return np.exp(x) ... And keep the same line count, and the functions would keep their __name__.
- georgehotz 5y agoI would merge this PR.