Skip to content

Commit 52023ef

Browse files
author
João Felipe Santos
committed
Removed broadcasting from PReLU
1 parent 13208e2 commit 52023ef

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

NAM/activations.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,9 @@ class ActivationPReLU : public Activation
232232

233233
// Prepare the slopes for the current matrix size
234234
std::vector<float> slopes_for_channels = negative_slopes;
235-
236-
if (slopes_for_channels.size() == 1 && actual_channels > 1)
237-
{
238-
// Broadcast single slope to all channels
239-
float slope = slopes_for_channels[0];
240-
slopes_for_channels.clear();
241-
slopes_for_channels.resize(actual_channels, slope);
242-
}
243-
else if (slopes_for_channels.size() != actual_channels)
244-
{
245-
// This should not happen in normal usage, but handle gracefully
246-
slopes_for_channels.resize(actual_channels, 0.01f); // Default slope
247-
}
235+
236+
// Fail loudly if input has more channels than activation
237+
assert(actual_channels == negative_slopes.size());
248238

249239
// Apply each negative slope to its corresponding channel
250240
for (unsigned long channel = 0; channel < actual_channels; channel++)

0 commit comments

Comments
 (0)