Skip to content

Commit e3e050c

Browse files
committed
DOC: Fixed failing doc-tests
1 parent 5498897 commit e3e050c

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/tensor/convert.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ impl<T: NumericTrait> Tensor<T> {
77
///
88
/// ```
99
/// # #[macro_use] extern crate numeric; fn main() {
10-
/// use numeric::Tensor;
11-
///
1210
/// let tdouble = tensor![1.0f64, 2.0, 3.0];
1311
/// let tsingle = tdouble.convert::<f32>();
1412
/// # }

src/tensor/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use std::ops::Add;
1818
/// A quick example:
1919
///
2020
/// ```
21-
/// use numeric::Tensor;
22-
/// let t = Tensor::new(vec![1.0f64, 3.0, 2.0, 2.0]).reshape(&[2, 2]);
21+
/// use numeric as nr;
22+
/// let t = nr::Tensor::new(vec![1.0f64, 3.0, 2.0, 2.0]).reshape(&[2, 2]);
2323
/// println!("t = {}", t);
2424
/// ```
2525
///
@@ -435,13 +435,13 @@ impl<T: TensorTrait> Tensor<T> {
435435
/// `AxisIndex` enum to specify indexing for each axis.
436436
///
437437
/// ```
438-
/// use numeric::{DoubleTensor, Ellipsis, StridedSlice, Index, Full};
438+
/// use numeric as nr;
439439
///
440-
/// let t = DoubleTensor::ones(&[2, 3, 4]);
440+
/// let t: nr::Tensor<f64> = nr::Tensor::ones(&[2, 3, 4]);
441441
///
442-
/// t.index(&[Ellipsis, StridedSlice(Some(1), Some(3), 1)]); // shape [2, 3, 2]
443-
/// t.index(&[Index(-1)]); // shape [3, 4]
444-
/// t.index(&[Full, StridedSlice(Some(1), None, 1), Index(1)]); // shape [2, 2]
442+
/// t.index(&[nr::Ellipsis, nr::StridedSlice(Some(1), Some(3), 1)]); // shape [2, 3, 2]
443+
/// t.index(&[nr::Index(-1)]); // shape [3, 4]
444+
/// t.index(&[nr::Full, nr::StridedSlice(Some(1), None, 1), nr::Index(1)]); // shape [2, 2]
445445
/// ```
446446
pub fn index(&self, selection: &[AxisIndex]) -> Tensor<T> {
447447
let (sel, mut newaxes) = self.expand_indices(selection);
@@ -789,9 +789,9 @@ impl<T: Copy + Add + Zero + One> Tensor<T> {
789789
/// Creates a new vector with integer values starting at 0 and counting up:
790790
///
791791
/// ```
792-
/// use numeric::DoubleTensor;
792+
/// use numeric as nr;
793793
///
794-
/// let t = DoubleTensor::range(5); // [ 0.00 1.00 2.00 3.00 4.00]
794+
/// let t: nr::Tensor<f64> = nr::Tensor::range(5); // [ 0.00 1.00 2.00 3.00 4.00]
795795
/// ```
796796
pub fn range(size: usize) -> Tensor<T> {
797797
let mut data = Vec::with_capacity(size);

0 commit comments

Comments
 (0)