本文整理汇总了C++中Connections::destroySynapse方法的典型用法代码示例。如果您正苦于以下问题:C++ Connections::destroySynapse方法的具体用法?C++ Connections::destroySynapse怎么用?C++ Connections::destroySynapse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connections
的用法示例。
在下文中一共展示了Connections::destroySynapse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adaptSegment
static void adaptSegment(
Connections& connections,
Segment segment,
const vector<CellIdx>& prevActiveCells,
Permanence permanenceIncrement,
Permanence permanenceDecrement)
{
const vector<Synapse>& synapses = connections.synapsesForSegment(segment);
for (SynapseIdx i = 0; i < synapses.size();)
{
const SynapseData& synapseData = connections.dataForSynapse(synapses[i]);
const bool isActive =
std::binary_search(prevActiveCells.begin(), prevActiveCells.end(),
synapseData.presynapticCell);
Permanence permanence = synapseData.permanence;
if (isActive)
{
permanence += permanenceIncrement;
}
else
{
permanence -= permanenceDecrement;
}
permanence = min(permanence, (Permanence)1.0);
permanence = max(permanence, (Permanence)0.0);
if (permanence < EPSILON)
{
connections.destroySynapse(synapses[i]);
// Synapses vector is modified in-place, so don't update `i`.
}
else
{
connections.updateSynapsePermanence(synapses[i], permanence);
i++;
}
}
if (synapses.size() == 0)
{
connections.destroySegment(segment);
}
}