perf: replace _uniform method to remove iteration on tensor#3042
perf: replace _uniform method to remove iteration on tensor#3042vfdev-5 merged 1 commit intopytorch:masterfrom
Conversation
|
Nice improvements, @MarcBresson ! For equality tests I would use I wonder how to see that
is equivalent to ? |
|
It was hard to wrap my head around the possible decisions that led to this code. Basically, the former code was creating a tensor that went from The new code just put 0 everywhere then compute the indices that should be set to The only difference between the two codes is when the kernel size is an even number, but this raise an error beforehand. |
vfdev-5
left a comment
There was a problem hiding this comment.
@MarcBresson thanks a lot for the perf improvement!
LGTM
This new version is much quicker (granted, it will not save a lot of absolute time).
It avoids enumerating on a tensor, which is always slow.
Performance comparison
Check for equality
Check list: