-
Notifications
You must be signed in to change notification settings - Fork 153
Update tensor_ops.py docs #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update tensor_ops.py docs #5
Conversation
The docs as currently written are a bit misleading as they suggest that these higher-order functions returns `Tensor`s directly, when in fact they return functions that return tensors.
| Returns: | ||
| :class:`TensorData` : new tensor data | ||
| function: A function that takes a tensor, applies `fn` to each cell, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon digging deeper here, it seems like the Args docs mix the arguments for the higher-order function and the function it returns...would it make sense to move the docs for a and out to be sub-points of this doc line (and so-forth for the other higher order functions).
|
@srush ping on this whenever you have a sec! Happy to update the docs for fast_ops accordingly if we are aligned here (in this PR or a follow up one). |
|
I think it is clear as written. Would rather at types everywhere or not at all. |
For sure – I found it personally helpful to "type out" the more conceptually complicated functions like these higher-order ones, but agree it might not be valuable to introduce types bit by bit.
To respectfully push back: As a learner, I think it's a bit confusing that the docs for the higher-order functions in operators.py document that these functions return other functions, but not here. Maybe I'm missing something, but they should be conceptually the same (except one operates on lists, the other tensors). Example in operators.py: Module-3/minitorch/operators.py Lines 128 to 142 in d774a3d
Happy to close the PR, just wanted to clarify my reasoning here! |
|
Aren't these docs the same though as Module-2? Is it specific to fast_ops? |
|
Sorry for the delay – was pretty heads down on Module-3 :)
Yes, they are the same as Module-2 – I just noticed when working on Module-3, but the same comment/suggestion applies for Module-2.
Nope, similar comments apply for cuda_ops. Perhaps the goal here is to document the pipeline of calling the higher-order function and then calling the returned function all in one go, like you do here? Module-3/minitorch/cuda_ops.py Lines 208 to 209 in 37940ff
If so, happy to leave as well – just tripped me up briefly when reading the docstrings! |
Problem:
The docs as currently written are a bit misleading as they suggest that
these higher-order functions returns
Tensors directly, when in factthey return functions that return
Tensors.Solution: