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

Function broadcast_scalar

src/models/stable_audio/same_autoencoder.cpp:167–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167core::TensorValue broadcast_scalar(
168 core::ModuleBuildContext & ctx,
169 const core::TensorValue & value,
170 const core::TensorValue & like) {
171 core::validate_shape(value, core::TensorShape::from_dims({1}), "Stable Audio SAME scalar");
172 core::TensorShape shape = {};
173 shape.rank = like.shape.rank;
174 for (size_t i = 0; i < shape.rank; ++i) {
175 shape.dims[i] = 1;
176 }
177 auto reshaped = core::reshape_tensor(ctx, value, shape);
178 return modules::RepeatModule({like.shape}).build(ctx, reshaped);
179}
180
181core::TensorValue dynamic_tanh_norm(
182 core::ModuleBuildContext & ctx,

Callers 1

dynamic_tanh_normFunction · 0.85

Calls 4

validate_shapeFunction · 0.85
reshape_tensorFunction · 0.85
RepeatModuleClass · 0.85
buildMethod · 0.45

Tested by

no test coverage detected