throw error the delay node tries to access values out of boundary without carry over values when in a loop.

This commit is contained in:
Dong Yu 2016-02-01 16:42:25 -08:00
Родитель 0fc4c0b3e8
Коммит ba3b4b565e
1 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -330,16 +330,26 @@ public:
if (t_delayed < 0)
{
if (m_delayedValue.IsEmpty()) //use first frame
inp = Input(0)->ValueFor(FrameRange(m_pMBLayout, 0));
if (m_delayedValue.IsEmpty())
{
if (IsPartOfLoop())
InvalidArgument("The delay node tries to access past values that are out of bound, possibly because there is no sentence start marker in the MBLayout.");
else //use first frame
inp = Input(0)->ValueFor(FrameRange(m_pMBLayout, 0));
}
else
inp = DataWithMBLayoutFor(m_delayedValue, FrameRange(m_delayedActivationMBLayout, t_delayed + T_delayedActivation), m_delayedActivationMBLayout);
}
else if (t_delayed >= T)
{
if (m_delayedValue.IsEmpty()) //use last frame
inp = Input(0)->ValueFor(FrameRange(m_pMBLayout, T-1));
if (m_delayedValue.IsEmpty())
{
if (IsPartOfLoop())
InvalidArgument("The delay node tries to access future values that are out of bound, possibly because there is no sentence end marker in the MBLayout.");
else //use last frame
inp = Input(0)->ValueFor(FrameRange(m_pMBLayout, T - 1));
}
else
inp = DataWithMBLayoutFor(m_delayedValue, FrameRange(m_delayedActivationMBLayout, t_delayed - T), m_delayedActivationMBLayout);
}