Skip to content

Commit 79187f2

Browse files
committed
ggml : restore ggml_type_sizef() to aboid major version bump (ggml/1441)
1 parent 48e6123 commit 79187f2

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

ggml/include/ggml.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,10 @@ extern "C" {
733733
GGML_API size_t ggml_type_size(enum ggml_type type); // size in bytes for all elements in a block
734734
GGML_API size_t ggml_row_size (enum ggml_type type, int64_t ne); // size in bytes for all elements in a row
735735

736+
GGML_DEPRECATED(
737+
GGML_API double ggml_type_sizef(enum ggml_type type), // ggml_type_size()/ggml_blck_size() as float
738+
"use ggml_row_size() instead");
739+
736740
GGML_API const char * ggml_type_name(enum ggml_type type);
737741
GGML_API const char * ggml_op_name (enum ggml_op op);
738742
GGML_API const char * ggml_op_symbol(enum ggml_op op);

ggml/src/ggml.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,12 @@ size_t ggml_row_size(enum ggml_type type, int64_t ne) {
12941294
return ggml_type_size(type)*ne/ggml_blck_size(type);
12951295
}
12961296

1297+
double ggml_type_sizef(enum ggml_type type) {
1298+
assert(type >= 0);
1299+
assert(type < GGML_TYPE_COUNT);
1300+
return ((double)(type_traits[type].type_size))/type_traits[type].blck_size;
1301+
}
1302+
12971303
const char * ggml_type_name(enum ggml_type type) {
12981304
assert(type >= 0);
12991305
assert(type < GGML_TYPE_COUNT);

0 commit comments

Comments
 (0)