[EIEX-885] Add log support using new Neutron flow#20145
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20145
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Cancelled JobAs of commit 99747d3 with merge base 2759ef1 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
| # Use 256 elements so that, after quantization to uint8, the input can | ||
| # cover the full discrete range [0, 255]. | ||
| # The dataset is generated as a linear float ramp and later quantized, | ||
| # which effectively exercises all uint8 values. |
There was a problem hiding this comment.
Nit: uint8 -> int8 (2 occurrences)
| class ConvBlocksWithLogModule(torch.nn.Module): | ||
| def __init__(self, conv_in_channels: int = 3): | ||
| super().__init__() | ||
| self.block1 = torch.nn.Sequential( | ||
| torch.nn.Conv2d( | ||
| in_channels=conv_in_channels, | ||
| out_channels=3, | ||
| kernel_size=(2, 2), | ||
| stride=(2, 2), | ||
| ), | ||
| torch.nn.ReLU(), | ||
| ) | ||
| self.block2 = torch.nn.Sequential( | ||
| torch.nn.Conv2d( | ||
| in_channels=conv_in_channels, | ||
| out_channels=10, | ||
| kernel_size=(2, 2), | ||
| stride=(2, 2), | ||
| ), | ||
| torch.nn.ReLU(), | ||
| ) | ||
|
|
||
| def forward(self, x): | ||
| x = self.block1(x) | ||
| x = x.clamp_min(1e-6).log() | ||
| return self.block2(x) |
There was a problem hiding this comment.
No change needed here, but such a complex test model is counterproductive. We prefer simple models (1 to 3 ops at most) which focus on some specific case as efficiently as possible. Here fore example, the Relu, Clamp and Relu have no effect on the testing conditions, but they make the test more complex and on lines 88-89, the test may require changes if the support for the related ops is modified (e.g. Vasek's Conv PR is merged).
| return self.block2(x) | ||
|
|
||
|
|
||
| class TestLog: |
There was a problem hiding this comment.
Please add a test using QAT. (All operators should have at least 1)
| equal to `high`, with increments depending on the total number of elements. | ||
| """ | ||
|
|
||
| def __init__(self, num_samples=2, low=0.0, high=1.0): |
There was a problem hiding this comment.
Nit: Perhaps it would be more useful to have the default range include negative values (for example if we want to use this to test relu/prelu/...). How about -1 to 1?
| dt.tofile(bin_file_name) | ||
|
|
||
|
|
||
| class LinearRampDatasetCreator(DatasetCreator): |
There was a problem hiding this comment.
Nice idea 👍🏻
Does this also work with the "int8 testing" added by @roman-janik-nxp last week?
Summary
NXP backend: Enable aten.log with new Neutron flow.
Test plan
Tests provided.
cc @robert-kalmar @JakeStevens @digantdesai @rascani