(self, a, b)
| 2993 | return tnp.sign(a) |
| 2994 | |
| 2995 | def dot(self, a, b): |
| 2996 | if len(b.shape) == 1: |
| 2997 | if len(a.shape) == 1: |
| 2998 | # inner product |
| 2999 | return tf.reduce_sum(tf.multiply(a, b)) |
| 3000 | else: |
| 3001 | # matrix vector |
| 3002 | return tf.linalg.matvec(a, b) |
| 3003 | else: |
| 3004 | if len(a.shape) == 1: |
| 3005 | return tf.linalg.matvec(b.T, a.T).T |
| 3006 | else: |
| 3007 | return tf.matmul(a, b) |
| 3008 | |
| 3009 | def abs(self, a): |
| 3010 | return tnp.abs(a) |