Skip to content

Commit ef2120f

Browse files
committed
CANN: fix acl_tensor memory alloc.
1 parent 90172d5 commit ef2120f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ggml/src/ggml-cann/acl_tensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ aclTensor* ggml_cann_create_tensor(const ggml_tensor* tensor, int64_t* ne,
6969
}
7070

7171
int64_t final_dims = (dims == 0 ? GGML_MAX_DIMS : dims);
72-
int64_t acl_storage_len = ggml_element_size(tensor);
72+
int64_t acl_storage_len = 1;
7373
for (int i = 0; i < final_dims; i++) {
7474
acl_storage_len += (acl_ne[i] - 1) * acl_stride[i];
7575
}

ggml/src/ggml-cann/acl_tensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ aclTensor* ggml_cann_create_tensor(void* data_ptr, aclDataType dtype,
103103

104104
int64_t acl_storage_len = 1;
105105
for (int i = 0; i < dims; i++) {
106-
acl_storage_len += (tmp_ne[i] - 1) * tmp_stride[i] * type_size;
106+
acl_storage_len += (tmp_ne[i] - 1) * tmp_stride[i];
107107
}
108108

109109
std::reverse(tmp_ne, tmp_ne + dims);

0 commit comments

Comments
 (0)