@@ -6855,7 +6855,9 @@ struct ggml_tensor * ggml_rope_impl(
68556855 struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
68566856
68576857 // TODO: just use a struct
6858- int32_t params[] = { n_past, n_dims, mode, n_ctx, *(int32_t*)&freq_base, *(int32_t*)&freq_scale};
6858+ int32_t params[6] = { n_past, n_dims, mode, n_ctx };
6859+ memcpy(params + 4, &freq_base, sizeof(float));
6860+ memcpy(params + 5, &freq_scale, sizeof(float));
68596861 assert(GGML_MAX_OP_PARAMS >= sizeof(params));
68606862 memcpy(result->params, ¶ms, sizeof(params));
68616863
@@ -7127,13 +7129,11 @@ struct ggml_tensor* ggml_pool_1d(
71277129 };
71287130 struct ggml_tensor* result = ggml_new_tensor(ctx, GGML_TYPE_F32, 2, ne);
71297131
7130- ggml_scratch_save(ctx);
71317132 struct ggml_tensor* c = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 4);
71327133 ((int32_t*)c->data)[0] = op;
71337134 ((int32_t*)c->data)[1] = k0;
71347135 ((int32_t*)c->data)[2] = s0;
71357136 ((int32_t*)c->data)[3] = p0;
7136- ggml_scratch_load(ctx);
71377137
71387138 result->op = GGML_OP_POOL_1D;
71397139 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
@@ -7170,7 +7170,6 @@ struct ggml_tensor* ggml_pool_2d(
71707170 };
71717171 struct ggml_tensor* result = ggml_new_tensor(ctx, GGML_TYPE_F32, 3, ne);
71727172
7173- ggml_scratch_save(ctx);
71747173 struct ggml_tensor* c = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 7);
71757174 ((int32_t*)c->data)[0] = op;
71767175 ((int32_t*)c->data)[1] = k0;
@@ -7179,7 +7178,6 @@ struct ggml_tensor* ggml_pool_2d(
71797178 ((int32_t*)c->data)[4] = s1;
71807179 ((int32_t*)c->data)[5] = p0;
71817180 ((int32_t*)c->data)[6] = p1;
7182- ggml_scratch_load(ctx);
71837181
71847182 result->op = GGML_OP_POOL_2D;
71857183 result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;
@@ -15823,7 +15821,8 @@ static void ggml_visit_parents(struct ggml_cgraph * cgraph, struct ggml_tensor *
1582315821 }
1582415822 }
1582515823
15826- if (node->op == GGML_OP_NONE && node->src0 == NULL && node->src1 == NULL && node->grad == NULL) {
15824+ // TODO: add ggml_dependency instead of checking for NULL
15825+ if (node->op == GGML_OP_NONE && node->src[0] == NULL && node->src[1] == NULL && node->grad == NULL) {
1582715826 // reached a leaf node, not part of the gradient graph (e.g. a constant)
1582815827 GGML_ASSERT(cgraph->n_leafs < GGML_MAX_NODES);
1582915828
0 commit comments