5 ms·
It's how you get commits like these, though https://github.com/geohot/tinygrad/commit/050636bcb1068beff62ed23392de02e2f5d80f22 https://github.com/geohot/tinygra
by striking 5y ago
It's how you get commits like these, though https://github.com/geohot/tinygrad/commit/050636bcb1068beff62ed23392de02e2f5d80f22 https://github.com/geohot/tinygrad/commit/050636bcb1068beff6...
Subject: here's two extra lines of precious code (#307)
diff --git a/tinygrad/__init__.py b/tinygrad/__init__.py
index 0deab3e9..31ac75d5 100644
--- a/tinygrad/__init__.py
+++ b/tinygrad/__init__.py
@@ -1,3 +1 @@
-import tinygrad.optim
-import tinygrad.tensor
-import tinygrad.nn
+from tinygrad import optim, tensor, nn
There's a difference between "I will refuse features like X/Y/Z" and "I want the length of the code file to be N lines at most". The former tells you both explicitly and implicitly which features not to bother contributing. The latter is just nonsense.
- recuter 5y agoThis is why the good lord gave us: https://github.com/psf/black https://github.com/psf/black Import line is actually improved with this commit. LGTM, ship it. We now return to your regularly scheduled bikeshedding.
- striking 5y agoYou're saving yourself from one kind of golfing, but not all of them. Additionally, I feel like installing an additional tool is kind of against the spirit of 1kLOC simplicity.
- dundarious 5y agoDev dependencies and release dependencies are distinct. There would be no sense in complaining about hypocrisy if a zero-dependency C project uses clang-format or valgrind, and similarly for a python project using black or mypy.
- recuter 5y agoI'm getting distinct uses Eclipse to write vogon poetry and Jira Master vibes from you. Any notes on the actual code in the OP beyond the import lines formatting?
- striking 5y agoI'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.