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
The frequent call to append might be expensive. Each call might deallocate and reallocate and copy existing slice data. Instead, we can make([]int64, n), then copy each generated element to the right place.
This function would crash the program if the parameter n is too large. It would be safer to add a check to panic if n is larger than a threshold.
The text was updated successfully, but these errors were encountered:
The current definition is here
gotorch/example/resnet/resnet.go
Lines 31 to 40 in 9010c80
I noticed some issues with this function.
The frequent call to
append
might be expensive. Each call might deallocate and reallocate and copy existing slice data. Instead, we canmake([]int64, n)
, then copy each generated element to the right place.This function would crash the program if the parameter
n
is too large. It would be safer to add a check to panic ifn
is larger than a threshold.The text was updated successfully, but these errors were encountered: