This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix bugs in NAS UI (deferred from previous releases) #2552
Merged
+953
−16
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Graph } from './graphUtils'; | ||
import * as fs from 'fs'; | ||
|
||
describe('Graph utils test', () => { | ||
it('Graph constructor darts', () => { | ||
const graph = new Graph(JSON.parse(fs.readFileSync('assets/darts/graph.json').toString()), true); | ||
const activation = JSON.parse(fs.readFileSync('assets/darts/log').toString().split('\n')[0]); | ||
expect(graph.nodes.length).toEqual(1842); | ||
expect(graph.edges.length).toEqual(927); | ||
const weights = graph.weightFromMutables(activation); | ||
expect(weights.get('["CNN/ModuleList[cells]/Cell[1]/ModuleList[mutable_ops]/Node[0]/InputChoice[input_switch]/input.228",' + | ||
'"CNN/ModuleList[cells]/Cell[1]/ModuleList[mutable_ops]/Node[1]/ModuleList[ops]/' + | ||
'LayerChoice[2]/PoolBN[maxpool]/MaxPool2d[pool]/input.229"]')).toBeCloseTo(0.125, 3); | ||
}); | ||
|
||
it('Graph constructor naive', () => { | ||
const graph = new Graph(JSON.parse(fs.readFileSync('assets/naive/graph.json').toString()), true); | ||
expect(graph.nodes.length).toEqual(51); | ||
expect(graph.edges.length).toEqual(37); | ||
expect(graph.mutableEdges.get('LayerChoice1')![0].length).toEqual(5); | ||
expect(graph.mutableEdges.get('LayerChoice1')![1].length).toEqual(5); | ||
expect(graph.mutableEdges.get('LayerChoice2')![0].length).toEqual(5); | ||
expect(graph.mutableEdges.get('LayerChoice2')![1].length).toEqual(5); | ||
expect(graph.mutableEdges.get('InputChoice3')![0].length).toEqual(4); | ||
}); | ||
}); |
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to move all unit test stuff into
test
directory like nnimanager.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the reference.
Jest will look for test files with any of the following popular naming conventions:
__tests__
folders.The .test.js / .spec.js files (or the tests folders) can be located at any depth under the src top level folder.
We recommend to put the test files (or tests folders) next to the code they are testing so that relative imports appear shorter. For example, if App.test.js and App.js are in the same folder, the test only needs to import App from './App' instead of a long relative path. Collocation also helps find tests more quickly in larger projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move them to
__tests__
folder. I checked nni manager conversion (test
folder) and jest doesn't recognize them automatically.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, nnimanager is using mocha for test, what is the reason that nasui select jest instead of mocha?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the default settings provided by react-scripts.