-
Notifications
You must be signed in to change notification settings - Fork 87
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
Delete convd_host_weights and update all tests using conv2d #16264
Open
shwetankTT
wants to merge
8
commits into
main
Choose a base branch
from
shwetankTT/conv_weight
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d176cf5
#14179: Delete convd_host_weights and update all tests using conv2d.
shwetankTT 5c99041
#14179: vgg11 & 16 integration.
shwetankTT 1a35331
#14179: mnist model
shwetankTT 2461196
#14179: segformer model
shwetankTT a8f2a34
#14179: resnet fix
shwetankTT 8abb28e
#14179: unet and sd
shwetankTT cadb3dd
#0: clean up
shwetankTT 4b9f3cf
#0: testing
shwetankTT 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
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 |
---|---|---|
|
@@ -63,6 +63,41 @@ def __call__(self, device, input_tensor): | |
if self.act_block_h is not None: | ||
conv_config.act_block_h_override = self.act_block_h | ||
|
||
conv_kwargs = { | ||
"input_layout": input_tensor.get_layout(), | ||
"in_channels": input_tensor.shape[3], | ||
"out_channels": self.out_channels, | ||
"batch_size": input_tensor.shape[0], | ||
"input_height": input_tensor.shape[1], | ||
"input_width": input_tensor.shape[2], | ||
"kernel_size": self.kernel_size, | ||
"stride": (self.conv_params[0], self.conv_params[1]), | ||
"padding": (self.conv_params[2], self.conv_params[3]), | ||
"dilation": (1, 1), | ||
"groups": self.groups, | ||
"device": device, | ||
"conv_config": conv_config, | ||
} | ||
|
||
if not ttnn.is_tensor_storage_on_device(self.weights): | ||
self.weights = ttnn.prepare_conv_weights( | ||
weight_tensor=self.weights, | ||
weights_format="OIHW", | ||
input_memory_config=input_tensor.memory_config(), | ||
**conv_kwargs, | ||
) | ||
self.bias = ( | ||
ttnn.prepare_conv_bias( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prepare weights should be performed in init part of the model not in inference part |
||
bias_tensor=self.bias, | ||
input_memory_config=input_tensor.memory_config(), | ||
**conv_kwargs, | ||
) | ||
if self.bias is not None | ||
else None | ||
) | ||
self.weights = ttnn.to_device(self.weights, device) | ||
self.bias = ttnn.to_device(self.bias, device) if self.bias else None | ||
|
||
[output_tensor, [_out_height, _out_width]] = ttnn.conv2d( | ||
input_tensor=input_tensor, | ||
weight_tensor=self.weights, | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
seems like most args are redundant between prepare_conv_weights and conv2d
I don't this we should hardcode params twice like kernel size (3, 3), all of these should be defined in one place.
It's weird that for prepare_conv_weights we use this kwargs dict, and on conv2d we use named argumets, I would align those.
Also, there is not need to define this conv_kwargs in case it's not going to be used, it should be under if where ttnn.prepare_conv_weights is.
This comment applies to all models changed.