@@ -577,10 +577,10 @@ extern "C" {
577
577
578
578
// this tensor...
579
579
enum ggml_tensor_flag {
580
- GGML_TENSOR_FLAG_INPUT = 1 , // ...is an input for the GGML compute graph
581
- GGML_TENSOR_FLAG_OUTPUT = 2 , // ...is an output for the GGML compute graph
582
- GGML_TENSOR_FLAG_PARAM = 4 , // ...contains trainable parameters
583
- GGML_TENSOR_FLAG_LOSS = 8 , // ...defines loss for numerical optimization (multiple loss tensors add up)
580
+ GGML_TENSOR_FLAG_INPUT = 1 , // ...is an input for the GGML compute graph
581
+ GGML_TENSOR_FLAG_OUTPUT = 2 , // ...is an output for the GGML compute graph
582
+ GGML_TENSOR_FLAG_PARAM = 4 , // ...contains trainable parameters
583
+ GGML_TENSOR_FLAG_LOSS = 8 , // ...defines loss for numerical optimization (multiple loss tensors add up)
584
584
};
585
585
586
586
// n-dimensional tensor
@@ -1410,14 +1410,14 @@ extern "C" {
1410
1410
// supports 3D: a->ne[2] == b->ne[1]
1411
1411
GGML_API struct ggml_tensor * ggml_get_rows (
1412
1412
struct ggml_context * ctx ,
1413
- struct ggml_tensor * a ,
1414
- struct ggml_tensor * b );
1413
+ struct ggml_tensor * a , // data
1414
+ struct ggml_tensor * b ); // row indices
1415
1415
1416
1416
GGML_API struct ggml_tensor * ggml_get_rows_back (
1417
1417
struct ggml_context * ctx ,
1418
- struct ggml_tensor * a ,
1419
- struct ggml_tensor * b ,
1420
- struct ggml_tensor * c );
1418
+ struct ggml_tensor * a , // gradients of ggml_get_rows result
1419
+ struct ggml_tensor * b , // row indices
1420
+ struct ggml_tensor * c ); // data for ggml_get_rows, only used for its shape
1421
1421
1422
1422
GGML_API struct ggml_tensor * ggml_diag (
1423
1423
struct ggml_context * ctx ,
@@ -1568,9 +1568,9 @@ extern "C" {
1568
1568
// a - dy
1569
1569
GGML_API struct ggml_tensor * ggml_rope_back (
1570
1570
struct ggml_context * ctx ,
1571
- struct ggml_tensor * a ,
1572
- struct ggml_tensor * b ,
1573
- struct ggml_tensor * c ,
1571
+ struct ggml_tensor * a , // gradients of ggml_rope result
1572
+ struct ggml_tensor * b , // positions
1573
+ struct ggml_tensor * c , // freq factors
1574
1574
int n_dims ,
1575
1575
int mode ,
1576
1576
int n_ctx_orig ,
@@ -2036,15 +2036,15 @@ extern "C" {
2036
2036
// loss function
2037
2037
2038
2038
GGML_API struct ggml_tensor * ggml_cross_entropy_loss (
2039
- struct ggml_context * ctx ,
2040
- struct ggml_tensor * a ,
2041
- struct ggml_tensor * b );
2039
+ struct ggml_context * ctx ,
2040
+ struct ggml_tensor * a , // logits
2041
+ struct ggml_tensor * b ); // labels
2042
2042
2043
2043
GGML_API struct ggml_tensor * ggml_cross_entropy_loss_back (
2044
- struct ggml_context * ctx ,
2045
- struct ggml_tensor * a ,
2046
- struct ggml_tensor * b ,
2047
- struct ggml_tensor * c );
2044
+ struct ggml_context * ctx ,
2045
+ struct ggml_tensor * a , // logits
2046
+ struct ggml_tensor * b , // labels
2047
+ struct ggml_tensor * c ); // gradients of cross_entropy_loss result
2048
2048
2049
2049
// AdamW optimizer step
2050
2050
// Paper: https://arxiv.org/pdf/1711.05101v3.pdf
@@ -2066,7 +2066,7 @@ extern "C" {
2066
2066
GGML_API void ggml_set_loss (struct ggml_tensor * tensor );
2067
2067
2068
2068
GGML_API void ggml_build_forward_expand (struct ggml_cgraph * cgraph , struct ggml_tensor * tensor );
2069
- GGML_API void ggml_build_backward_expand (struct ggml_context * ctx , struct ggml_cgraph * gf , struct ggml_cgraph * gb , bool accumulate , bool keep );
2069
+ GGML_API void ggml_build_backward_expand (struct ggml_context * ctx , struct ggml_cgraph * gf , struct ggml_cgraph * gb , bool accumulate );
2070
2070
2071
2071
GGML_API void ggml_build_opt_adamw (
2072
2072
struct ggml_context * ctx ,
0 commit comments