| 121 | |
| 122 | template <typename Fn> |
| 123 | core::TensorValue build_unary( |
| 124 | core::ModuleBuildContext & ctx, |
| 125 | const core::TensorValue & input, |
| 126 | Fn fn) { |
| 127 | if (ctx.ggml == nullptr) { |
| 128 | throw std::runtime_error("ModuleBuildContext.ggml is null"); |
| 129 | } |
| 130 | core::validate_rank_between(input, 1, core::kMaxTensorRank, "input"); |
| 131 | const auto contiguous = core::ensure_backend_addressable_layout(ctx, input); |
| 132 | return core::wrap_tensor(fn(ctx.ggml, contiguous.tensor), input.shape, GGML_TYPE_F32); |
| 133 | } |
| 134 | |
| 135 | core::TensorShape make_snake_alpha_shape(const core::TensorShape & input, int64_t hidden_size) { |
| 136 | core::TensorShape shape = {}; |
no test coverage detected