Implement a simple coloring for ReLU layers.
Note: might not actually work.
This commit is contained in:
@@ -31,6 +31,7 @@ ActivityAnimation::ActivityAnimation(
|
||||
:
|
||||
bufferLength(3 * interactions.size())
|
||||
{
|
||||
CHECK(coloring) << "Invalid coloring function passed.";
|
||||
startingPos.reserve(bufferLength);
|
||||
delta.reserve(bufferLength);
|
||||
colorBuf.reserve(interactions.size());
|
||||
|
||||
@@ -165,7 +165,15 @@ static Animation *getReLUAnimation(const fmri::LayerData &prevState,
|
||||
|
||||
results = deduplicate(results);
|
||||
|
||||
return new ActivityAnimation(results, prevPositions.data(), curPositions.data(), -10);
|
||||
const auto maxValue = max_element(results.begin(), results.end())->first;
|
||||
|
||||
return new ActivityAnimation(results, prevPositions.data(), curPositions.data(), -10, [=](float i) -> ActivityAnimation::Color {
|
||||
if (maxValue == 0) {
|
||||
return {1, 1, 1};
|
||||
} else {
|
||||
return {1 - i / maxValue, 1 - i / maxValue, 1};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Animation * fmri::getActivityAnimation(const fmri::LayerData &prevState, const fmri::LayerData &curState,
|
||||
|
||||
Reference in New Issue
Block a user