ggml : reuse ggml_new_i32

pull/431/head
Georgi Gerganov 2 years ago
parent 4e0e2520f0
commit d922aa4aef
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

@ -3016,15 +3016,7 @@ struct ggml_tensor * ggml_diag_mask_inf(
// TODO: when implement backward, fix this: // TODO: when implement backward, fix this:
//struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a); //struct ggml_tensor * result = inplace ? ggml_view_tensor(ctx, a) : ggml_dup_tensor(ctx, a);
struct ggml_tensor * result = ggml_view_tensor(ctx, a); struct ggml_tensor * result = ggml_view_tensor(ctx, a);
struct ggml_tensor * b = ggml_new_i32(ctx, n_past);
// TODO: FIX ME !!!!!!!!!!!!!!!!!!!!!!!!
void * tmp = ctx->scratch.data;
ctx->scratch.data = NULL;
struct ggml_tensor * b = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 1);
((int32_t *) b->data)[0] = n_past;
ctx->scratch.data = tmp;
result->op = GGML_OP_DIAG_MASK_INF; result->op = GGML_OP_DIAG_MASK_INF;
result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;

Loading…
Cancel
Save