Hacker News new | ask | show | jobs
by hahahaha23 3072 days ago
To be honest, I don’t understand its popularity.

For example, I was trying to understand a batch normalization function defined as

def batchnorm_forward(x, gamma, beta, eps):

I can’t tell if gamma/beta are scalar or vector?

3 comments

We have type annotations in python now which can be used to clarify data types in function signatures.

https://docs.python.org/3/library/typing.html

Wouldn't the default assumption be that you can use either a scalar or vector?
You could try np.isscalar() and np.array().ndim in NumPy.