You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cases where the shape of a tensor is known in the frontend (e.g. constants), we should not generate code to retrieve the shape dynamically. Instead, we can just return the shape of the trace tensor.
One way to do this would be to update the shape property of the frontend tensor to check if the shape of the trace tensor is known (check that all dimensions are non-negative integers). If it is, we can just return that shape directly.
A case where this optimization could be very important is in tp.Parameters. When we overwrite the parameters of a module, we perform shape/dtype checks to ensure that the new parameter is compatible. We should add a test to make sure this is sufficiently fast (we can use the benchmark fixture and add a test under test_perf.py).
The text was updated successfully, but these errors were encountered:
In cases where the shape of a tensor is known in the frontend (e.g. constants), we should not generate code to retrieve the shape dynamically. Instead, we can just return the shape of the trace tensor.
One way to do this would be to update the
shape
property of the frontend tensor to check if the shape of the trace tensor is known (check that all dimensions are non-negative integers). If it is, we can just return that shape directly.A case where this optimization could be very important is in
tp.Parameter
s. When we overwrite the parameters of a module, we perform shape/dtype checks to ensure that the new parameter is compatible. We should add a test to make sure this is sufficiently fast (we can use thebenchmark
fixture and add a test undertest_perf.py
).The text was updated successfully, but these errors were encountered: