-
Notifications
You must be signed in to change notification settings - Fork 137
Add subdiagonalCount:superdiagonalCount:
argument labels to Tensor.bandPart
.
#588
Conversation
….bandPart`. Argument labels improve clarity.
c9dd415
to
ef6f22f
Compare
lowerCount:upperCount:
argument labels to Tensor.bandPart
.subdiagonalCount:superdiagonalCount:
argument labels to Tensor.bandPart
.
|
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.
I'm a big +1 on the improvements to the documentation. Thank you.
As for switching from positional arguments to required argument labels... I think this is a good use, as it is very easy to forget which one is for above the diagonal, and which one is for below. My only concern is that this makes writing out an invocation of bandPart
to be very long. I don't have a better idea for now, so this LGTM in general.
One quick nit, however: could you add a deprecated no-label version to help make it a smoother migration for users?
Thanks very much!
I suspect this will also help get CI to pass (https://source.cloud.google.com/results/invocations/5b144b04-f116-41f9-b435-574cd360de47/targets/s4tf%2Fapis%2Fubuntu%2Fpresubmit/log) |
Sure! Done in 71db9e5. |
@dan-zheng, Agree. The verbosity is an important thing and it is good to have the naming to avoid confusion. I don't have a strong opinion about how the arguments should be called in |
I'm glad we all agree! The Swift API design guidelines clearly (haha) advocate clarity:
The Swift API design guidelines recommend avoiding abbrevations:
"Easily found by a web search" is a concrete measure that we can verify: The top results for "subdiag" and "superdiag" are not related to diagonals from linear algebra: "diag" refers to something else, as in "subdiagram" or "super diagnostics". Later results do reference subdiagonals and superdiagonals, showing that "subdiag" and "superdiag" are common in-domain abbreviations. They're very reasonable as local variable names. To adhere to the API design guidelines and to maintain consistency with the rest of the codebase, I'd recommend that we continue to avoid abbreviations. |
Review feedback has been addressed. |
subdiagonalCount:superdiagonalCount:
argument labels improve clarity.Parameter descriptions copied from https://www.tensorflow.org/api_docs/python/tf/linalg/band_part.
cc @awav