{"record":{"id":"cf48740836d6584a","repo":"jax-ml/jax","slug":"where-argument-of-self","errorCode":null,"errorMessage":"where argument of {self}","messagePattern":"where argument of (.+?)","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/ufunc_api.py","lineNumber":180,"sourceCode":"    # because they are considered implementation details rather than\n    # necessary parts of object identity.\n    return hash((self._func, self.__name__, self.identity,\n                 self.nin, self.nout, self.nargs))\n\n  def __eq__(self, other: Any) -> bool:\n    return isinstance(other, ufunc) and (\n      (self._func, self.__name__, self.identity, self.nin, self.nout, self.nargs) ==\n      (other._func, other.__name__, other.identity, other.nin, other.nout, other.nargs))\n\n  def __repr__(self) -> str:\n    return f\"<jnp.ufunc '{self.__name__}'>\"\n\n  def __call__(self, *args: ArrayLike, out: None = None, where: None = None) -> Any:\n    check_arraylike(self.__name__, *args)\n    if out is not None:\n      raise NotImplementedError(f\"out argument of {self}\")\n    if where is not None:\n      raise NotImplementedError(f\"where argument of {self}\")\n    call = (self.__static_props['call']\n            or cast(Callable[..., Any], self._call_vectorized))\n    return call(*args)\n\n  @api.jit(static_argnames=['self'])\n  def _call_vectorized(self, *args):\n    return vectorize(self._func)(*args)\n\n  @api.jit(static_argnames=['self', 'axis', 'dtype', 'out', 'keepdims'])\n  def reduce(self, a: ArrayLike, axis: int | None = 0,\n             dtype: DTypeLike | None = None,\n             out: None = None, keepdims: bool = False, initial: ArrayLike | None = None,\n             where: ArrayLike | None = None) -> Array:\n    \"\"\"Reduction operation derived from a binary function.\n\n    JAX implementation of :meth:`numpy.ufunc.reduce`.\n\n    Args:","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/ufunc_api.py#L162-L198","documentation":"JAX ufunc objects accept numpy's where keyword for signature compatibility but vectorized masking (where=) is not implemented for generic ufuncs. Passing a non-None where raises NotImplementedError.","triggerScenarios":"jnp.multiply(x, y, where=mask) on a generic jnp.ufunc.","commonSituations":"Porting numpy code that uses where= for conditional elementwise updates.","solutions":["Replace with jnp.where(mask, x op y, default)","Use x.at[...].set(...) with boolean masks for conditional assignment"],"exampleFix":"// before\njnp.multiply(x, y, where=mask)\n// after\njnp.where(mask, x * y, x)","handlingStrategy":"fallback","validationCode":"if where is not None:\n    result = jnp.where(where, ufunc(*args), default)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Translate numpy where= patterns to jnp.where during porting"],"tags":["jax","ufunc","where-mask","numpy-compat"],"backgroundTag":"unsupported-where-parameter","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}