2

I was surprised to see numpy.ones_like listed in the list of ufuncs here. Is this just an oversight, or is there specific use case?

Benjamin
  • 11,560
  • 13
  • 70
  • 119

1 Answers1

3

That is an oversight in the documentation. ones_like is not a ufunc. It is implemented in numpy/core/numeric.py, along with zeros_like and similar functions. It uses the shape and data type of the argument, but it does not perform an elementwise operation.

Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214