-
-
Notifications
You must be signed in to change notification settings - Fork 98
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 reshape
function
#55
Labels
Comments
First working version in 1215ed5. Note that this requires nightly because a |
Closed
Another approach that is slightly more readable and self contained (but still requires struct True;
trait ConstAssert {
type Result;
}
struct ConstEq<const A: usize, const B: usize>;
impl<const A: usize> ConstAssert for ConstEq<A, A> {
type Result = True;
}
fn copy<Lhs: Count, Rhs: Count>(lhs: &Lhs, rhs: &mut Rhs)
where
ConstEq<{ Lhs::NUM_ELEMENTS }, { Rhs::NUM_ELEMENTS }>: ConstAssert<Result = True>,
{
let l = lhs.ref_first() as *const f32;
let r = rhs.mut_first() as *mut f32;
unsafe {
std::ptr::copy_nonoverlapping(l, r, Lhs::NUM_ELEMENTS);
}
} |
coreylowman
added a commit
that referenced
this issue
Jul 6, 2022
coreylowman
added a commit
that referenced
this issue
Jul 18, 2022
coreylowman
added a commit
that referenced
this issue
Jul 18, 2022
coreylowman
added a commit
that referenced
this issue
Jul 20, 2022
coreylowman
added a commit
that referenced
this issue
Jul 20, 2022
coreylowman
added a commit
that referenced
this issue
Jul 20, 2022
coreylowman
added a commit
that referenced
this issue
Jul 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would only work for two tensors with the same number of elements. This can be used for #34
The text was updated successfully, but these errors were encountered: