MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / build_unary

Function build_unary

src/framework/modules/activation_modules.cpp:123–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122template <typename Fn>
123core::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
135core::TensorShape make_snake_alpha_shape(const core::TensorShape & input, int64_t hidden_size) {
136 core::TensorShape shape = {};

Callers 1

buildMethod · 0.85

Calls 3

validate_rank_betweenFunction · 0.85
wrap_tensorFunction · 0.85

Tested by

no test coverage detected