Computer Vision News - February 2021

19 JAX Convolutions The final example shows how to use a random3D kernel and display a 3D convolution (in the NHWDC pattern). In [4]: from jax import jit In [5]: @jit ...: def f(x, y): ...: a = x * y ...: b = (x + y) / (x - y) ...: c = a + 2 ...: return a + b * c ...: In [6]: x = jnp.array([2., 0.]) In [7]: y = jnp.array([3., 0.]) In [8]: f(x, y) Invalid value encountered in the output of a jit function. Calling the de-optimized version. --------------------------------------------------------------------------- FloatingPointError Traceback (most recent call last) <ipython-input-8-811b7ddb3300> in <module>() ----> 1 f(x, y) ... stack trace ... <ipython-input-5-619b39acbaac> in f(x, y) 2 def f(x, y): 3 a = x * y ----> 4 b = (x + y) / (x - y) 5 c = a + 2 6 return a + b * c .../jax/jax/numpy/lax_numpy.pyc in divide(x1, x2) 343 return floor_divide(x1, x2) 344 else: --> 345 return true_divide(x1, x2) 346 347 .../jax/jax/numpy/lax_numpy.pyc in true_divide(x1, x2) 332 x1, x2 = _promote_shapes(x1, x2) 333 return lax.div(lax.convert_element_type(x1, result_dtype), --> 334 lax.convert_element_type(x2, result_dtype)) 335 336 .../jax/jax/lax.pyc in div(x, y) 244 def div(x, y): 245 r"""Elementwise division: :math:`x \over y`.""" --> 246 return div_p.bind(x, y) 247 248 def rem(x, y): ... stack trace ...

RkJQdWJsaXNoZXIy NTc3NzU=