ggml : add tensor flags

This commit is contained in:
slaren 2024-01-24 02:44:33 +01:00
parent 963a122398
commit cad465253d
2 changed files with 13 additions and 4 deletions

1
ggml.c
View file

@ -2548,6 +2548,7 @@ static struct ggml_tensor * ggml_new_tensor_impl(
/*.nb =*/ { 0, 0, 0, 0 },
/*.op =*/ GGML_OP_NONE,
/*.op_params =*/ { 0 },
/*.flags =*/ 0,
/*.is_param =*/ false,
/*.grad =*/ NULL,
/*.src =*/ { NULL },

12
ggml.h
View file

@ -506,6 +506,12 @@ extern "C" {
GGML_LOG_LEVEL_DEBUG = 5
};
enum ggml_tensor_flags {
GGML_TENSOR_INPUT = 1,
GGML_TENSOR_OUTPUT = 2,
GGML_TENSOR_PARAM = 4,
};
// ggml object
struct ggml_object {
size_t offs;
@ -539,7 +545,9 @@ extern "C" {
// op params - allocated as int32_t for alignment
int32_t op_params[GGML_MAX_OP_PARAMS / sizeof(int32_t)];
bool is_param;
int32_t flags;
bool is_param; // TODO: move to flags
struct ggml_tensor * grad;
struct ggml_tensor * src[GGML_MAX_SRC];
@ -558,7 +566,7 @@ extern "C" {
void * extra; // extra things e.g. for ggml-cuda.cu
char padding[8];
char padding[12];
};
static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);