-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added doc-comments to tensor.rs #12
Conversation
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.
This is pretty good! The top level comments are all fine. Some of the comments on associated types and trait functions seem a bit unnecessary. Especially for Out
, Output
. @sphw, could you take a look as well?
libs/nox/src/tensor.rs
Outdated
pub trait MapDim<D> { | ||
/// The item associated with the dimension mapping. |
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.
We probably don't need these inner comments.
libs/nox/src/tensor.rs
Outdated
pub trait DimConcat<A, B> { | ||
/// The resulting dimension type after concatenation. |
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.
This is implied.
libs/nox/src/tensor.rs
Outdated
pub trait TensorIndex<T, D: TensorDim> { | ||
/// The output type resulting from the indexing operation. |
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.
This is implied.
The commit message has a typo btw |
ddb5d8a
to
7fb7274
Compare
Thanks, I have fixed the commit text and removed inner comments. |
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.
Just have a nitpick on the Tensor
comment, but ok to merge once that's fixed.
libs/nox/src/tensor.rs
Outdated
@@ -10,6 +11,8 @@ use std::{ | |||
}; | |||
use xla::{ArrayElement, ElementType, NativeType}; | |||
|
|||
/// Represents a tensor with a specific type `T`, dimensionality `D`, and parameterization `P`. |
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.
"underlying representation P
" is a bit more accurate.
libs/nox/src/tensor.rs
Outdated
@@ -10,6 +11,8 @@ use std::{ | |||
}; | |||
use xla::{ArrayElement, ElementType, NativeType}; | |||
|
|||
/// Represents a tensor with a specific type `T`, dimensionality `D`, and parameterization `P`. | |||
/// `P` dictates the underlying representation and operations available on the tensor. |
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.
"operations available on the tensor" is not quite accurate. Would just drop this sentence, and change the previous sentence to include the "underlying representation" part.
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.
Done!
Signed-off-by: Akhil Velagapudi <[email protected]>
Signed-off-by: Akhil Velagapudi <[email protected]>
Following the discussion in issue11, here is a PR adding doc comments to
tensor.rs
. This is a first test in introducing AI-generated comments to document the library faster, making it easier to pick up by new users.Here is a preview of what it looks like in conditions (
cargo doc --open --no-deps --all-features
):This is a test to think about the viability of this approach. Do feel free to comment and criticize (things can definitely be streamlined by hand, this PR had no manual tweak of the comments so far)!
For archival purposes, here is the prompt used to generate the comments (with GPT-4):