Skip to content
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

Functional iterator for single axis for Tensor (not TensorView) #3

Closed
wants to merge 1 commit into from

Conversation

Aman-Amith-Shastry
Copy link
Collaborator

This iterator works for a single axis and on a Tensor object. Users can access the shape, stride, and elements of each iterable as a normal TensorView object. Testing has been done for 2, 3, and 4-dimensional arrays across multiple axes. In each new test created, only one axis has been uncommented, while others are left commented for ease of comprehension. For now, testing has been done manually.

@@ -0,0 +1,116 @@
use crate::data_buffer::{DataBuffer, DataOwned, DataView};

Check warning

Code scanning / clippy

unused import: DataOwned Warning

unused import: DataOwned
@@ -0,0 +1,116 @@
use crate::data_buffer::{DataBuffer, DataOwned, DataView};
use crate::dtype::RawDataType;
use crate::{tensor, TensorView};

Check warning

Code scanning / clippy

unused import: tensor Warning

unused import: tensor
}
}

impl<'a, T, B> Iterator for IteratorBase<'a, T, B>

Check warning

Code scanning / clippy

the following explicit lifetimes could be elided: 'a Warning

the following explicit lifetimes could be elided: 'a
}
}

impl<'a, T, B> Iterator for IteratorBase<'a, T, B>

Check warning

Code scanning / clippy

the following explicit lifetimes could be elided: 'a Warning

the following explicit lifetimes could be elided: 'a
let mut new_shape = self.shape.clone();
let mut new_stride = self.stride.clone();

for i in 0..self.axis {

Check warning

Code scanning / clippy

the loop variable i is only used to index new_stride Warning

the loop variable i is only used to index new\_stride
let mut new_stride = self.stride.clone();

for i in 0..self.axis {
new_stride[i] = new_stride[i] / new_shape[self.axis];

Check warning

Code scanning / clippy

manual implementation of an assign operation Warning

manual implementation of an assign operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants