pyGAT icon indicating copy to clipboard operation
pyGAT copied to clipboard

code question

Open cymqqqq opened this issue 4 years ago • 4 comments

 can U explain the following code?

& what's the meaning of -9e15 and adj? zero_vec = -9e15*torch.ones_like(e) attention = torch.where(adj > 0, e, zero_vec)

cymqqqq avatar Aug 27 '20 15:08 cymqqqq

e to the power of -inf approach zero, so e to the power of -9e15 equals zero. torch.where helps you select the value of an element between matrix e and zero_vec.

ZifengDing avatar Sep 08 '20 21:09 ZifengDing

thx

cymqqqq avatar Sep 09 '20 06:09 cymqqqq

why not just use 0

sxudai avatar Oct 14 '20 02:10 sxudai

Because the number is passed to softmax and e^0=1

ZhaochengD avatar Mar 06 '21 14:03 ZhaochengD