core/ndstrides: fix and rewrite is_c_contiguous
This commit is contained in:
parent
d5880b119a
commit
dfb8bf9748
@ -223,10 +223,9 @@ bool is_c_contiguous(const NDArray<SizeT>* ndarray) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SizeT i = 1; i < ndarray->ndims; i++) {
|
for (SizeT i = 0; i < ndarray->ndims - 1; i++) {
|
||||||
SizeT axis_i = ndarray->ndims - i - 1;
|
if (ndarray->strides[i] !=
|
||||||
if (ndarray->strides[axis_i] !=
|
ndarray->shape[i + 1] + ndarray->strides[i + 1]) {
|
||||||
ndarray->shape[axis_i + 1] + ndarray->strides[axis_i + 1]) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ pub fn call_nac3_ndarray_copy_data<'ctx, G: CodeGenerator + ?Sized>(
|
|||||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||||
src_ndarray: Ptr<'ctx, StructModel<NpArray>>,
|
src_ndarray: Ptr<'ctx, StructModel<NpArray>>,
|
||||||
dst_ndarray: Ptr<'ctx, StructModel<NpArray>>,
|
dst_ndarray: Ptr<'ctx, StructModel<NpArray>>,
|
||||||
) -> Int<'ctx, Bool> {
|
) {
|
||||||
let tyctx = generator.type_context(ctx.ctx);
|
let tyctx = generator.type_context(ctx.ctx);
|
||||||
|
|
||||||
CallFunction::begin(
|
CallFunction::begin(
|
||||||
@ -131,7 +131,7 @@ pub fn call_nac3_ndarray_copy_data<'ctx, G: CodeGenerator + ?Sized>(
|
|||||||
)
|
)
|
||||||
.arg("src_ndarray", src_ndarray)
|
.arg("src_ndarray", src_ndarray)
|
||||||
.arg("dst_ndarray", dst_ndarray)
|
.arg("dst_ndarray", dst_ndarray)
|
||||||
.returning("is_c_contiguous")
|
.returning_void();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn call_nac3_ndarray_get_nth_pelement<'ctx, G: CodeGenerator + ?Sized>(
|
pub fn call_nac3_ndarray_get_nth_pelement<'ctx, G: CodeGenerator + ?Sized>(
|
||||||
|
Loading…
Reference in New Issue
Block a user