Skip to content

Commit b22708f

Browse files
committed
fix cuda
1 parent 4d01953 commit b22708f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ggml/src/ggml-cuda/scale.cu

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ void ggml_cuda_op_scale(ggml_backend_cuda_context & ctx, ggml_tensor * dst) {
2424
GGML_ASSERT(src0->type == GGML_TYPE_F32);
2525
GGML_ASSERT( dst->type == GGML_TYPE_F32);
2626

27-
float scale = ((const float *)(dst->op_params))[0];
28-
float bias = ((const float *)(dst->op_params))[1];
27+
float scale;
28+
float bias;
29+
memcpy(&scale, dst->op_params, sizeof(float));
30+
memcpy(&bias, (float *) dst->op_params + 1, sizeof(float));
2931

3032
scale_f32_cuda(src0_d, dst_d, scale, bias, ggml_nelements(src0), stream);
3133
}

0 commit comments

Comments
 (0)