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

Function broadcast_last_dim

src/models/stable_audio/same_autoencoder.cpp:151–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151core::TensorValue broadcast_last_dim(
152 core::ModuleBuildContext & ctx,
153 const core::TensorValue & value,
154 const core::TensorValue & like,
155 int64_t dim) {
156 core::validate_shape(value, core::TensorShape::from_dims({dim}), "Stable Audio SAME broadcast value");
157 core::TensorShape shape = {};
158 shape.rank = like.shape.rank;
159 for (size_t i = 0; i < shape.rank; ++i) {
160 shape.dims[i] = 1;
161 }
162 shape.dims[shape.rank - 1] = dim;
163 auto reshaped = core::reshape_tensor(ctx, value, shape);
164 return modules::RepeatModule({like.shape}).build(ctx, reshaped);
165}
166
167core::TensorValue broadcast_scalar(
168 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