-
Notifications
You must be signed in to change notification settings - Fork 352
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
f_
pattern bloating
#395
Comments
The main reason for this is that this crate is a wrapper around the C++ PyTorch api which uses exceptions to report errors so it's not easy to know statically which C++ method could raise an exception and which shouldn't. The alternative would be to only provide the functions that can fail but that would result in all the model code having a lot of extra |
I can definitely see this may be a personal preference, but I would rather use
What about documentation, does this not require duplicating any rustdoc comments? (or make writting rustdoc comment more awkward?). I suppose these factors become less significant if it is expected the Rust documentation shouldn't really be used for anything other than just matching the method names from the Python documentation.
I would argue that any method which could fail should return I was thinking about submitting a pull request adding significant amount to documentation with bunch of examples, would this even work, is there some non-standard mechanism I would need to use here? Also a slightly off topic question. From readme.md
Does this mean a pull request adding a macro |
The automatically generated part has no documentation. It's a one to one mapping with the C++ api so one should refer to this bit for the up to date documentation.
That would be a problem indeed as such documentation would be removed on the next pytorch updated. And even if it wasn't removed it might become out of sync. Ideally the file providing the function description that we use to generate the code would also include the documentation but that's not the case at the moment (tensorflow packages all this together btw which is neat).
The idea is that this crate provides some mostly low level wrappers around the c++ api. More opiniated/featurefull framework can probably be build on top of it. Re |
I have once converted the main project that I use I guess an alternative would be to make two separate traits for methods that have fallible/unwrapping counterparts and let the user import the |
In my view it seems unnecessary to duplicate every function which may return an error, e.g.
Tensor::reshape
andTensor::f_reshape
.This pattern is not seen in any other popular libraries (the Tensorflow bindings and ndarray being two examples), and I believe for good reason. It adds gigantic bloat to documentation and the codebase all to simply abstract an
unwrap
away (the inverse of propagating an error, so it both adds bloat and makes errors slightly less clear).What is the reason behind this design choice?
The text was updated successfully, but these errors were encountered: