@@ -2626,7 +2626,8 @@ struct ggml_tensor * ggml_reglu(
2626
2626
struct ggml_tensor * a ) {
2627
2627
GGML_ASSERT (ggml_is_contiguous_1 (a ));
2628
2628
2629
- struct ggml_tensor * result = ggml_new_tensor_2d (ctx , a -> type , a -> ne [0 ] / 2 , a -> ne [1 ]);
2629
+ int64_t ne [GGML_MAX_DIMS ] = { a -> ne [0 ] / 2 }; for (int i = 1 ; i < GGML_MAX_DIMS ; i ++ ) ne [i ] = a -> ne [i ];
2630
+ struct ggml_tensor * result = ggml_new_tensor_impl (ctx , a -> type , GGML_MAX_DIMS , ne , NULL , 0 );
2630
2631
2631
2632
ggml_set_op_params_i32 (result , 0 , (int32_t ) GGML_UNARY_OP_REGLU );
2632
2633
@@ -2643,7 +2644,8 @@ struct ggml_tensor * ggml_geglu(
2643
2644
struct ggml_tensor * a ) {
2644
2645
GGML_ASSERT (ggml_is_contiguous_1 (a ));
2645
2646
2646
- struct ggml_tensor * result = ggml_new_tensor_2d (ctx , a -> type , a -> ne [0 ] / 2 , a -> ne [1 ]);
2647
+ int64_t ne [GGML_MAX_DIMS ] = { a -> ne [0 ] / 2 }; for (int i = 1 ; i < GGML_MAX_DIMS ; i ++ ) ne [i ] = a -> ne [i ];
2648
+ struct ggml_tensor * result = ggml_new_tensor_impl (ctx , a -> type , GGML_MAX_DIMS , ne , NULL , 0 );
2647
2649
2648
2650
ggml_set_op_params_i32 (result , 0 , (int32_t ) GGML_UNARY_OP_GEGLU );
2649
2651
@@ -2660,7 +2662,8 @@ struct ggml_tensor * ggml_swiglu(
2660
2662
struct ggml_tensor * a ) {
2661
2663
GGML_ASSERT (ggml_is_contiguous_1 (a ));
2662
2664
2663
- struct ggml_tensor * result = ggml_new_tensor_2d (ctx , a -> type , a -> ne [0 ] / 2 , a -> ne [1 ]);
2665
+ int64_t ne [GGML_MAX_DIMS ] = { a -> ne [0 ] / 2 }; for (int i = 1 ; i < GGML_MAX_DIMS ; i ++ ) ne [i ] = a -> ne [i ];
2666
+ struct ggml_tensor * result = ggml_new_tensor_impl (ctx , a -> type , GGML_MAX_DIMS , ne , NULL , 0 );
2664
2667
2665
2668
ggml_set_op_params_i32 (result , 0 , (int32_t ) GGML_UNARY_OP_SWIGLU );
2666
2669
0 commit comments