What does the “at” (@) symbol do in Python?

前端 未结 12 949
萌比男神i
萌比男神i 2020-11-22 01:57

I\'m looking at some Python code which used the @ symbol, but I have no idea what it does. I also do not know what to search for as searching Python docs or Goo

12条回答
  •  一生所求
    2020-11-22 02:36

    If you are referring to some code in a python notebook which is using Numpy library, then @ operator means Matrix Multiplication. For example:

    import numpy as np
    def forward(xi, W1, b1, W2, b2):
        z1 = W1 @ xi + b1
        a1 = sigma(z1)
        z2 = W2 @ a1 + b2
        return z2, a1
    

提交回复
热议问题