I’ve met following statement in python numpy library
Z = inputs @ self.weights[1:].T + + self.weights[0]
I don’t understand exactly what does it mean in this line of code
I’ve made researchtations and did not found proper explanation
>Solution :
There is no + + operator in Python. This is two separate operators, the unary positive operator and the binary sum operator. Observe:
>>> import dis
>>> dis.dis("x + + y")
0 0 RESUME 0
1 2 LOAD_NAME 0 (x)
4 LOAD_NAME 1 (y)
6 CALL_INTRINSIC_1 5 (INTRINSIC_UNARY_POSITIVE)
8 BINARY_OP 0 (+)
12 RETURN_VALUE
Similar to the unary negative operator, -. e.g:
x = 10
y = -x
print(y) # -10
I suspect this is just a typo. Cases where unary + actually matters are extremely rare, and this doesn’t look like one of them. Particularly, unary + is not an absolute value operator – if the input is negative, the output will be negative too.