-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Open
Labels
module: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
I created a network using torch.acos() and encountered a Nan error during its training.
The reason is that an input value to torch.acos () approaches 1 or -1, causing the grad to diverge, and resulting in value.grad = Nan.
I know that torch.acos () can only handle values in the range from -1 to 1, and limited the input value's range from -1 to 1 using clamp(min=-1,max=1). However this error has occurred.
Finally I solved this by limiting input from -1 + eps to 1-eps with eps = 1e-7.
I think that many users would encounter this error.
I suggest "to alert this in the explanation of torch.acos() function in document" or "to change function to explicitly limit the range of values by including eps as argument".
AdelZakirov, amirhfarzaneh, Solacex, meder411, laycoding and 50 moreSaptam04 and zxhchosharathadavanne, poweic, jaymody, LutingWang, matteoTaiana and 14 more
Metadata
Metadata
Assignees
Labels
module: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblockstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module