{"record":{"id":"95607e251614d2f5","repo":"jax-ml/jax","slug":"dtype-argument-to-weibull-min-must-be-a-float-dt","errorCode":null,"errorMessage":"dtype argument to `weibull_min` must be a float dtype, got {dtype}","messagePattern":"dtype argument to `weibull_min` must be a float dtype, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/random/core.py","lineNumber":2975,"sourceCode":"  on the domain :math:`0 < x < \\infty`, where :math:`c > 0` is the concentration\n  parameter, and :math:`\\sigma > 0` is the scale parameter.\n\n  Args:\n    key: a PRNG key.\n    scale: The scale parameter of the distribution.\n    concentration: The concentration parameter of the distribution.\n    shape: The shape added to the parameters loc and scale broadcastable shape.\n    dtype: The type used for samples.\n\n  Returns:\n    A jnp.array of samples.\n\n  \"\"\"\n  key, _ = _check_prng_key(\"weibull_min\", key)\n  dtype = dtypes.check_and_canonicalize_user_dtype(\n      float if dtype is None else dtype)\n  if not dtypes.issubdtype(dtype, np.floating):\n    raise ValueError(f\"dtype argument to `weibull_min` must be a float \"\n                     f\"dtype, got {dtype}\")\n  shape = core.canonicalize_shape(shape)\n  return _weibull_min(key, scale, concentration, shape, dtype)\n\n\n@jit(static_argnums=(3, 4))\ndef _weibull_min(key, scale, concentration, shape, dtype) -> Array:\n  random_uniform = uniform(\n      key=key, shape=shape, minval=0, maxval=1, dtype=dtype)\n\n  # Inverse weibull CDF.\n  return jnp.power(-jnp.log1p(-random_uniform), 1.0/concentration) * scale\n\n\ndef orthogonal(\n  key: ArrayLike,\n  n: int,\n  shape: Shape = (),","sourceCodeStart":2957,"sourceCodeEnd":2993,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/random/core.py#L2957-L2993","documentation":"jax.random.weibull_min requires its dtype argument to be a floating-point dtype. After canonicalization (default float), dtypes.issubdtype(dtype, np.floating) is checked; integer, bool, or complex dtypes fail with this ValueError.","triggerScenarios":"Calling jax.random.weibull_min(key, scale, concentration, shape, dtype) where dtype is np.int32, np.bool_, or np.complex64.","commonSituations":"Reusing an int dtype from a discrete sampler, or building a generic wrapper that forwards a user-supplied dtype without validating it against the sampler's requirements.","solutions":["Use a float dtype (np.float32/np.float64/jnp.bfloat16) or omit dtype","Validate forwarded dtypes in wrappers: assert np.issubdtype(dtype, np.floating)"],"exampleFix":"// before\nx = jax.random.weibull_min(key, 1.0, 2.0, (n,), dtype=jnp.int32)\n// after\nx = jax.random.weibull_min(key, 1.0, 2.0, (n,), dtype=jnp.float32)","handlingStrategy":"validation","validationCode":"import numpy as np\nassert dtype is None or np.issubdtype(np.dtype(dtype).type, np.floating), 'weibull_min needs float dtype'","typeGuard":"def is_float_dtype(d) -> bool:\n    import numpy as np\n    return d is None or d is float or np.issubdtype(np.dtype(d).type, np.floating)","tryCatchPattern":null,"preventionTips":["Pass np.float32 explicitly in configs","Never forward discrete-sampler dtypes to continuous samplers"],"tags":["jax","random","dtype-validation"],"backgroundTag":"invalid-dtype-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}