Calculate a scaled, vector inner product between lists of Tensors.
(scale, xs, ys, name=None)
| 67 | |
| 68 | |
| 69 | def _scaled_dot_product(scale, xs, ys, name=None): |
| 70 | """Calculate a scaled, vector inner product between lists of Tensors.""" |
| 71 | with ops.name_scope(name, 'scaled_dot_product', [scale, xs, ys]) as scope: |
| 72 | # Some of the parameters in our Butcher tableau include zeros. Using |
| 73 | # _possibly_nonzero lets us avoid wasted computation. |
| 74 | return math_ops.add_n( |
| 75 | [(scale * x) * y for x, y in zip(xs, ys) |
| 76 | if _possibly_nonzero(x) and _possibly_nonzero(y)], |
| 77 | name=scope) |
| 78 | |
| 79 | |
| 80 | def _dot_product(xs, ys, name=None): |
no test coverage detected