From 98eb262b1f22c15cdc54609652207ad688ca16ac Mon Sep 17 00:00:00 2001 From: Liu Liu Date: Tue, 3 Dec 2024 16:38:33 -0500 Subject: [PATCH] Fix a bug when reinit tensor, we didn't do so with stride. --- lib/nnc/ccv_nnc_symbolic_graph_compile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/nnc/ccv_nnc_symbolic_graph_compile.c b/lib/nnc/ccv_nnc_symbolic_graph_compile.c index 1d4ec8ad9..743ea270a 100644 --- a/lib/nnc/ccv_nnc_symbolic_graph_compile.c +++ b/lib/nnc/ccv_nnc_symbolic_graph_compile.c @@ -4266,7 +4266,10 @@ int ccv_nnc_tensor_arena_reinit(ccv_nnc_tensor_arena_t* const tensor_arena, cons const int alias_ref = tensor_arena->vt_alias_refs[i] - 1; ccv_nnc_tensor_data(tensor->info, tensor_arena->vt_tensors[alias_ref]->data.u8, off + tensor_arena->vt_tensors[alias_ref]->dataof, &tensor->data, &tensor->dataof); if (CCV_IS_TENSOR_VIEW(tensor)) + { ((ccv_nnc_tensor_view_t*)tensor)->off = off; + memcpy(((ccv_nnc_tensor_view_t*)tensor)->stride, symbol_info->stride, sizeof(((ccv_nnc_tensor_view_t*)tensor)->stride)); + } } } // Should handle sub_tensor_arena, don't do that at the moment.