def count_params(x):
"""Returns the number of scalars in a Keras variable.
Arguments:
x: Keras variable.
Returns:
Integer, the number of scalars in `x`.
Example:
```python
>>> kvar = K.zeros((2,3))
>>> K.count_params(kvar)
6
>>> K.eval(kvar)
array([[ 0., 0., 0.],
[ 0., 0., 0.]], dtype=float32)
"""
shape = x.get_shape()
return np.prod([shape[i]._value for i in range(len(shape))])
```