Skip to content

Commit

Permalink
Configure rustfmt to tidy doc comments (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry73204 committed Jun 2, 2020
1 parent b66b2fd commit df8dec7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/pretrained-models/main.rs
Expand Up @@ -59,7 +59,7 @@ pub fn main() -> Result<()> {

// Apply the forward pass of the model to get the logits.
let output = net
.forward_t(&image.unsqueeze(0), /*train=*/ false)
.forward_t(&image.unsqueeze(0), /* train= */ false)
.softmax(-1, tch::Kind::Float); // Convert to probability.

// Print the top 5 categories for this image.
Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
@@ -0,0 +1 @@
format_code_in_doc_comments = true
8 changes: 4 additions & 4 deletions src/tensor/index.rs
Expand Up @@ -8,7 +8,7 @@
//! be used to get all the indexes from a given dimension.
//!
//! ```
//! use crate::tch::{Tensor,IndexOp};
//! use crate::tch::{IndexOp, Tensor};
//! let tensor = Tensor::of_slice(&[1, 2, 3, 4, 5, 6]).view((2, 3));
//! let t = tensor.i(1);
//! let t = tensor.i((.., -2));
Expand All @@ -17,7 +17,7 @@
//! Indexes like `1..`, `..1`, or `1..2`, can be used to narrow a dimension.
//!
//! ```
//! use crate::tch::{Tensor,IndexOp};
//! use crate::tch::{IndexOp, Tensor};
//! let tensor = Tensor::of_slice(&[1, 2, 3, 4, 5, 6]).view((2, 3));
//! let t = tensor.i((.., 1..));
//! assert_eq!(t.size(), [2, 2]);
Expand All @@ -36,11 +36,11 @@
//! The `NewAxis` index can be used to insert a dimension.
//!
//! ```
//! use crate::tch::{Tensor, IndexOp, NewAxis};
//! use crate::tch::{IndexOp, NewAxis, Tensor};
//! let tensor = Tensor::of_slice(&[1, 2, 3, 4, 5, 6]).view((2, 3));
//! let t = tensor.i((NewAxis,));
//! assert_eq!(t.size(), &[1, 2, 3]);
//! let t = tensor.i((..,..,NewAxis));
//! let t = tensor.i((.., .., NewAxis));
//! assert_eq!(t.size(), &[2, 3, 1]);
//! ```
//!
Expand Down

0 comments on commit df8dec7

Please sign in to comment.