-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ Layer ] Move the Weight Read Function to Layer object #2856
base: main
Are you sure you want to change the base?
Conversation
It is more flexible to moe Weight Read Fuction to Layer Object itself, rather than having layer_node. Sometimes, it is necessary to change the read weight depending on Layer Type, such as Batch normalization layer. This PR move general read implementation to Layer_devel and layer is able to override it as it needs. **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: jijoong.moon <[email protected]>
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.
LGTM overall
} else { | ||
for (unsigned int i = 0; i < run_context.getNumWeights(); ++i) { | ||
/// @note shared weights are only be read at the first acecss | ||
// if (run_context->isGradientLastAccess(i)) { |
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.
// if (run_context->isGradientLastAccess(i)) { |
let's remove this line
TensorDim dim = run_context.getWeight(i).getDim(); | ||
dim.setDataType(definedWeightDataType); | ||
Tensor T_read(dim, true); |
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.
TensorDim dim = run_context.getWeight(i).getDim(); | |
dim.setDataType(definedWeightDataType); | |
Tensor T_read(dim, true); | |
Tensor T_read = run_context.getWeight(i).clone(definedWeightDataType); |
we can utilize Tensor::clone
here :)
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.
LGTM
It is more flexible to moe Weight Read Fuction to Layer Object itself,
rather than having layer_node. Sometimes, it is necessary to change
the read weight depending on Layer Type, such as Batch normalization
layer.
This PR move general read implementation to Layer_devel and layer is
able to override it as it needs.
Self evaluation:
Signed-off-by: jijoong.moon [email protected]