Skip to content

Commit

Permalink
Fix a bug when reinit tensor, we didn't do so with stride.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Dec 3, 2024
1 parent ce93a48 commit 98eb262
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/nnc/ccv_nnc_symbolic_graph_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 98eb262

Please sign in to comment.