[NeoML] CDnnHeadAdapterLayer#1058
Draft
daniyalaliev wants to merge 8 commits intoneoml-lib:masterfrom
Draft
Conversation
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
| // Which of the blobs will be used during learn | ||
| int blobsForLearn; | ||
| // Save first adapter name to connect to necessary head in serialization | ||
| CString firstAdapter; |
Contributor
There was a problem hiding this comment.
What if the first adapter will be removed from the dnn?
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
favorart
reviewed
May 7, 2024
|
|
||
| auto headSource = static_cast<CCompositeSourceLayer*>(internalDnn->GetLayer("source").Ptr()); | ||
| headSource->SetBlob(inputBlobs[0]); | ||
| internalDnn->runOnce( 0 ); |
Contributor
There was a problem hiding this comment.
The special test should be where the CDnnHeadAdapterLayer is inside the CRecursiveLayer.
favorart
reviewed
May 7, 2024
|
|
||
| using namespace NeoML; | ||
| using namespace NeoMLTest; | ||
|
|
Contributor
There was a problem hiding this comment.
Please, add one more test with the exact scenario suggested by the user of this feature
IMathEngine& mathEngine = MathEngine();
CRandom random( 42 );
CDnn dnn( random, mathEngine );
// To be able run the same set of layers 3 times
// on 3 different inputs to get 3 different outputs links
CPtr<CDnnHead> head = new CDnnHead<
CFullyConnectedLayer,
CGELULayer,
CFullyConnectedLayer,
CReLULayer,
CDropoutLayer,
CFullyConnectedLayer
>(
random, mathEngine,
FullyConnected( 128 ),
Gelu(),
FullyConnected( 64 ),
Relu(),
Dropout( 0.5f ),
FullyConnected( 1 )
);
CBaseLayer* x = Source( dnn, "srcX" );
x = FullyConnected( 512 )( x );
x = Gelu()( x );
x = DnnHeadAdapter( head )( x ); // #1 head dnn call
CBaseLayer* y = Source( dnn, "srcY" );
y = FullyConnected( 512 )( y );
y = Gelu()( y );
y = DnnHeadAdapter( head )( y ); // #2 head dnn call
CBaseLayer* z = Source( dnn, "srcZ" );
z = FullyConnected( 512 )( z );
z = Gelu()( z );
z = DnnHeadAdapter( head )( z ); // #3 head dnn call
CBaseLayer* out = ConcatChannels()( x, y, z );
CBaseLayer* labels = Source( dnn, "labels" );
BinaryCrossEntropyLoss()( out, labels );
favorart
reviewed
May 8, 2024
NeoML/src/Dnn/DnnOptimization.cpp
Outdated
| CDnnHeadAdapterLayer* head = dynamic_cast<CDnnHeadAdapterLayer*>(layer); | ||
| if (head != nullptr) | ||
| { | ||
| OptimizeDnn(*(head->GetDnnHead()->GetInnerDnn())); |
Contributor
There was a problem hiding this comment.
If there is a only one adapter for this exact sub-network, this adapter should be removed and sub-net reconnected directly, as it works for a composite in the optimization::UnpackComposites.
favorart
reviewed
May 10, 2024
favorart
reviewed
May 21, 2024
favorart
reviewed
May 30, 2024
favorart
reviewed
May 30, 2024
c77fccb to
dcbedff
Compare
… repeats Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: daniyalaliev <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
Signed-off-by: Kirill Golikov <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.