From 3e819d32a8b889c2693af41474ab2a60422d8898 Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 21 Jan 2024 14:10:37 +0100 Subject: [PATCH] - fixed crashes --- source/MainComponent.cpp | 1 + source/RbmComponent.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/MainComponent.cpp b/source/MainComponent.cpp index 1657c50..d831e2f 100644 --- a/source/MainComponent.cpp +++ b/source/MainComponent.cpp @@ -816,6 +816,7 @@ void MainComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged) { int index = m_rbmSelect->getSelectedItemIndex(); m_pLayer = static_cast(m_stack->getLayer(index)); + m_weightIndex = 0; updateControls(); m_pLayer->redrawWeights(m_weightIndex); if (m_stack->trainingBatch().n_rows > 0) diff --git a/source/RbmComponent.cpp b/source/RbmComponent.cpp index b268d1e..e98b234 100644 --- a/source/RbmComponent.cpp +++ b/source/RbmComponent.cpp @@ -56,11 +56,15 @@ RbmComponent::RbmComponent (DeepStack &stack, const std::string &name, size_t id m_toggleEnable->addListener (this); m_toggleEnable->setToggleState(true, NotificationType::dontSendNotification); - addAndMakeVisible (m_buttonCopyH2C = new TextButton ("Copy hidden state to context")); + addChildComponent (m_buttonCopyH2C = new TextButton ("Copy hidden state to context")); m_buttonCopyH2C->setTooltip (TRANS("Copy hidden state to context input")); m_buttonCopyH2C->setButtonText (TRANS("H2C")); m_buttonCopyH2C->addListener (this); + if (m_numContext) + { + m_buttonCopyH2C->setVisible(true); + } redrawWeights(); setSize (m_sizeX, m_sizeY); @@ -251,8 +255,11 @@ void RbmComponent::buttonClicked(Button* buttonThatWasClicked) } else if (buttonThatWasClicked == m_buttonCopyH2C) { - DrawContextTrain->getData() = DrawHidden->getData(); - m_stack.upDownPass(id(), getTraining()); + if (m_numContext) + { + DrawContextTrain->getData() = DrawHidden->getData(); + m_stack.upDownPass(id(), getTraining()); + } } }