jax.numpy.floor_divide
Contents
jax.numpy.floor_divide#
- jax.numpy.floor_divide(x1,x2,/)[source]#
Calculates the floor division of x1 by x2 element-wise
JAX implementation of
numpy.floor_divide.- Parameters:
x1 (ArrayLike) – Input array, the dividend
x2 (ArrayLike) – Input array, the divisor
- Returns:
An array-like object containing each of the quotients rounded downto the nearest integer towards negative infinity. This is equivalentto
x1//x2in Python.- Return type:
Note
x1//x2is equivalent tojnp.floor_divide(x1,x2)for arraysx1andx2See also
jax.numpy.divide()andjax.numpy.true_divide()for floating pointdivision.Examples
>>>x1=jnp.array([10,20,30])>>>x2=jnp.array([3,4,7])>>>jnp.floor_divide(x1,x2)Array([3, 5, 4], dtype=int32)
>>>x1=jnp.array([-5,-4,-3,-2,-1,0,1,2,3,4,5])>>>x2=3>>>jnp.floor_divide(x1,x2)Array([-2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 1], dtype=int32)
>>>x1=jnp.array([6,6,6],dtype=jnp.int32)>>>x2=jnp.array([2.0,2.5,3.0],dtype=jnp.float32)>>>jnp.floor_divide(x1,x2)Array([3., 2., 2.], dtype=float32)
Contents
