ggml : add tensor flags
This commit is contained in:
parent
963a122398
commit
cad465253d
2 changed files with 13 additions and 4 deletions
1
ggml.c
1
ggml.c
|
@ -2548,6 +2548,7 @@ static struct ggml_tensor * ggml_new_tensor_impl(
|
||||||
/*.nb =*/ { 0, 0, 0, 0 },
|
/*.nb =*/ { 0, 0, 0, 0 },
|
||||||
/*.op =*/ GGML_OP_NONE,
|
/*.op =*/ GGML_OP_NONE,
|
||||||
/*.op_params =*/ { 0 },
|
/*.op_params =*/ { 0 },
|
||||||
|
/*.flags =*/ 0,
|
||||||
/*.is_param =*/ false,
|
/*.is_param =*/ false,
|
||||||
/*.grad =*/ NULL,
|
/*.grad =*/ NULL,
|
||||||
/*.src =*/ { NULL },
|
/*.src =*/ { NULL },
|
||||||
|
|
12
ggml.h
12
ggml.h
|
@ -506,6 +506,12 @@ extern "C" {
|
||||||
GGML_LOG_LEVEL_DEBUG = 5
|
GGML_LOG_LEVEL_DEBUG = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ggml_tensor_flags {
|
||||||
|
GGML_TENSOR_INPUT = 1,
|
||||||
|
GGML_TENSOR_OUTPUT = 2,
|
||||||
|
GGML_TENSOR_PARAM = 4,
|
||||||
|
};
|
||||||
|
|
||||||
// ggml object
|
// ggml object
|
||||||
struct ggml_object {
|
struct ggml_object {
|
||||||
size_t offs;
|
size_t offs;
|
||||||
|
@ -539,7 +545,9 @@ extern "C" {
|
||||||
// op params - allocated as int32_t for alignment
|
// op params - allocated as int32_t for alignment
|
||||||
int32_t op_params[GGML_MAX_OP_PARAMS / sizeof(int32_t)];
|
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 * grad;
|
||||||
struct ggml_tensor * src[GGML_MAX_SRC];
|
struct ggml_tensor * src[GGML_MAX_SRC];
|
||||||
|
@ -558,7 +566,7 @@ extern "C" {
|
||||||
|
|
||||||
void * extra; // extra things e.g. for ggml-cuda.cu
|
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);
|
static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue