| 149 | } |
| 150 | |
| 151 | core::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 | |
| 167 | core::TensorValue broadcast_scalar( |
| 168 | core::ModuleBuildContext & ctx, |
no test coverage detected