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

add zeros, and compute offset #88

Merged
merged 5 commits into from
Jul 1, 2024
Merged

add zeros, and compute offset #88

merged 5 commits into from
Jul 1, 2024

Conversation

edgarriba
Copy link
Member

@edgarriba edgarriba commented Jul 1, 2024

Implement:

  • from_shape_val
  • from_shape_fn
  • get_iter_offset
  • get_unchecked
  • zeros
  • map
  • cast
  • aliases for Tensor1, Tensor2, Tensor3, Tensor4

src/tensor/mod.rs Outdated Show resolved Hide resolved
@edgarriba edgarriba merged commit 065d3b1 into main Jul 1, 2024
9 checks passed
/// let t = Tensor::<u8, 2>::from_shape_fn([2, 2], |[i, j]| (i * 2 + j) as u8);
/// assert_eq!(t.data, vec![0, 1, 2, 3]);
/// ```
pub fn from_shape_fn<F>(shape: [usize; N], f: F) -> Self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

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