after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def __rsub__(self, other): return _ensure_poly(other) - self
def __rsub__(self, other): return self + -other
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __divmod__(self, divisor): if self.is_constant: return divmod(int(self), divisor) else: def divided(count): q, r = divmod(count, divisor) if r != 0: raise ValueError( "shapecheck currently only supports strides " ...
def __divmod__(self, divisor): if self.is_constant: q, r = divmod(int(self), divisor) return constant_poly(q), r def divided(count): q, r = divmod(count, divisor) if r != 0: raise ValueError( "shapecheck currently only supports strides " ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __hash__(self): return hash(tuple(sorted(self.items())))
def __hash__(self): return hash(super())
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __eq__(self, other): return super().__eq__(_ensure_poly(other))
def __eq__(self, other): return super().__eq__(ensure_poly(other))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __ge__(self, other): other = _ensure_poly(other) if other.is_constant and self.is_constant: return int(self) >= int(other) elif other.is_constant and int(other) <= 1: # Assume nonzero polynomials are positive, allows use in shape rules return True elif self.is_constant and i...
def __ge__(self, other): other = ensure_poly(other) if other.is_constant and self.is_constant: return int(self) >= int(other) if other.is_constant and int(other) <= 1: # Assume polynomials > 0, allowing to use shape rules of binops, conv: return True if self.is_constant and in...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __le__(self, other): return _ensure_poly(other) >= self
def __le__(self, other): return ensure_poly(other) >= self
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __gt__(self, other): return not (_ensure_poly(other) >= self)
def __gt__(self, other): return not (ensure_poly(other) >= self)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __int__(self): assert self.is_constant return op.index(next(iter(self.values())))
def __int__(self): assert self.is_constant return int(next(iter(self.values())))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def finalize_spec(spec, shape): return tuple( _parse_lit(d) if e is _monomorphic_dim else e for e, d in zip(spec, shape) )
def finalize_spec(spec, shape): return tuple( parse_lit(d) if e is monomorphic_dim else e for e, d in zip(spec, shape) )
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def parse_spec(spec=""): if not spec: return ShapeSpec(()) if spec[0] == "(": if spec[-1] != ")": raise ShapeSyntaxError(spec) spec = spec[1:-1] dims = map(_parse_dim, spec.replace(" ", "").strip(",").split(",")) return ShapeSpec(dims)
def parse_spec(spec=""): if not spec: return ShapeSpec(()) if spec[0] == "(": if spec[-1] != ")": raise ShapeSyntaxError(spec) spec = spec[1:-1] dims = map(parse_dim, spec.replace(" ", "").strip(",").split(",")) return ShapeSpec(dims)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __getitem__(self, idx): return parse_spec( ("(" + ",".join(map(str, idx)) + ")") if type(idx) is tuple else str(idx) )
def __getitem__(self, idx): if type(idx) is tuple: return parse_spec("(" + ",".join(map(str, idx)) + ")") else: return parse_spec(str(idx))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def is_pure(self): return all(type(poly) is not Poly or poly.is_constant for poly in self.shape_expr)
def is_pure(self): return all(ensure_poly(poly).is_constant for poly in self.shape_expr)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def process_primitive(self, primitive, tracers, params): vals, shape_exprs = unzip2((t.val, t.shape_expr) for t in tracers) if primitive in shape_parameterized_primitive_rules: rule = shape_parameterized_primitive_rules[primitive] out, out_shape = rule(shape_envs, vals, shape_exprs, **params) ...
def process_primitive(self, primitive, tracers, params): vals, shape_exprs = unzip2((t.val, t.shape_expr) for t in tracers) if primitive in shape_parameterized_primitive_rules: rule = shape_parameterized_primitive_rules[primitive] out, out_shape = rule(shape_envs, vals, shape_exprs, **params) ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __init__(self, trace, val, shape_expr): self._trace = trace self.val = val self.shape_expr = shape_expr
def __init__(self, trace, shape_expr): self._trace = trace self.shape_expr = shape_expr
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def aval(self): return ShapedArray(self.shape_expr, self.val.dtype)
def aval(self): return ShapedArray(self.shape_expr, None)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def full_lower(self): if self.is_pure(): return core.full_lower(self.val) else: return self
def full_lower(self): return self
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def pure(self, val): return MaskTracer(self, val, onp.shape(val))
def pure(self, val): return ShapeCheckTracer(self, onp.shape(val))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def lift(self, val): return MaskTracer(self, val, onp.shape(val))
def lift(self, val): return ShapeCheckTracer(self, onp.shape(val))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def sublift(self, val): return MaskTracer(self, val.val, val.shape_expr)
def sublift(self, val): return ShapeCheckTracer(self, val.shape_expr)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def process_primitive(self, primitive, tracers, params): vals, shape_exprs = unzip2((t.val, t.shape_expr) for t in tracers) if primitive in shape_parameterized_primitive_rules: rule = shape_parameterized_primitive_rules[primitive] out, out_shape = rule(shape_envs, vals, shape_exprs, **params) ...
def process_primitive(self, primitive, tracers, params): avals = [t.aval for t in tracers] shape_rule = shape_rules.get(primitive) if shape_rule is None: raise NotImplementedError( "Shape rule for {} not implemented yet.".format(primitive) ) out_shape = shape_rule(*avals, **p...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def process_call(self, call_primitive, f: lu.WrappedFun, tracers, params): raise NotImplementedError # TODO mask-of-jit
def process_call(self, call_primitive, f: lu.WrappedFun, tracers, params): # TODO apply proper subtrace: return map(self.full_raise, f.call_wrapped(*tracers))
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def broadcast_shapes(*shapes): """Returns the shape that results from NumPy broadcasting of `shapes`.""" if len(shapes) == 1: return shapes[0] ndim = _max(len(shape) for shape in shapes) shapes = onp.array([(1,) * (ndim - len(shape)) + shape for shape in shapes]) is_zero = onp.any(shapes == ...
def broadcast_shapes(*shapes): """Returns the shape that results from NumPy broadcasting of `shapes`.""" if len(shapes) == 1: return shapes[0] ndim = _max(len(shape) for shape in shapes) shapes = onp.array([(1,) * (ndim - len(shape)) + shape for shape in shapes]) is_zero = onp.any(shapes == ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def iota(dtype: DType, size: int) -> Array: """Wraps XLA's `Iota <https://www.tensorflow.org/xla/operation_semantics#iota>`_ operator. """ size = size if type(size) is masking.Poly else int(size) shape = canonicalize_shape((size,)) dtype = dtypes.canonicalize_dtype(dtype) lazy_expr = laz...
def iota(dtype: DType, size: int) -> Array: """Wraps XLA's `Iota <https://www.tensorflow.org/xla/operation_semantics#iota>`_ operator. """ size = int(size) dtype = dtypes.canonicalize_dtype(dtype) lazy_expr = lazy.iota(dtype, size) aval = ShapedArray((size,), dtype) return xla.Device...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def standard_primitive(shape_rule, dtype_rule, name, translation_rule=None): prim = Primitive(name) prim.def_impl(partial(xla.apply_primitive, prim)) prim.def_abstract_eval( partial(standard_abstract_eval, prim, shape_rule, dtype_rule) ) xla.translations[prim] = translation_rule or partial(s...
def standard_primitive(shape_rule, dtype_rule, name, translation_rule=None): prim = Primitive(name) prim.def_impl(partial(xla.apply_primitive, prim)) prim.def_abstract_eval( partial(standard_abstract_eval, prim, shape_rule, dtype_rule) ) xla.translations[prim] = translation_rule or partial(s...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _check_shapelike(fun_name, arg_name, obj): """Check that `obj` is a shape-like value (e.g. tuple of nonnegative ints).""" if not isinstance(obj, (tuple, list, onp.ndarray)): msg = "{} {} must be of type tuple/list/ndarray, got {}." raise TypeError(msg.format(fun_name, arg_name, type(obj))) ...
def _check_shapelike(fun_name, arg_name, obj): """Check that `obj` is a shape-like value (e.g. tuple of nonnegative ints).""" if type(obj) is tuple and masking.is_polymorphic(obj): return obj if not isinstance(obj, (tuple, list, onp.ndarray)): msg = "{} {} must be of type tuple/list/ndarray,...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _scan_masking_rule( shape_envs, padded_vals, shape_exprs, forward, length, jaxpr, num_consts, num_carry, linear, ): out_shape = _scan_shape_rule( shape_exprs, forward, length, jaxpr, num_consts, num_carry, linear ) dynamic_length = length.evaluate(shape_envs.l...
def _scan_masking_rule( shape_envs, padded_vals, shape_exprs, forward, length, jaxpr, num_consts, num_carry, linear, ): out_shape = _scan_shape_rule( shape_exprs, forward, length, jaxpr, num_consts, num_carry, linear ) dynamic_length = masking.eval_dim_expr(shape_...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def broadcast_to(arr, shape): """Like Numpy's broadcast_to but doesn't necessarily return views.""" arr = arr if isinstance(arr, ndarray) else array(arr) shape = canonicalize_shape(shape) # check that shape is concrete arr_shape = _shape(arr) if arr_shape == shape: return arr else: ...
def broadcast_to(arr, shape): """Like Numpy's broadcast_to but doesn't necessarily return views.""" arr = arr if isinstance(arr, ndarray) else array(arr) shape = tuple(map(int, shape)) # check that shape is concrete arr_shape = _shape(arr) if arr_shape == shape: return arr else: ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _normalize_index(index, axis_size): """Normalizes an index value in the range [-N, N) to the range [0, N).""" if type(axis_size) is Poly: return index + axis_size if index < 0 else index return lax.select( lax.lt(index, _constant_like(index, 0)), lax.add(index, _constant_like(in...
def _normalize_index(index, axis_size): """Normalizes an index value in the range [-N, N) to the range [0, N).""" return lax.select( lax.lt(index, _constant_like(index, 0)), lax.add(index, _constant_like(index, axis_size)), index, )
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _index_to_gather(x_shape, idx): # Remove ellipses and add trailing slice(None)s. idx = _canonicalize_tuple_index(len(x_shape), idx) # Check for advanced indexing: # https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing # Do the advanced indexing axes appear contiguo...
def _index_to_gather(x_shape, idx): # Remove ellipses and add trailing slice(None)s. idx = _canonicalize_tuple_index(len(x_shape), idx) # Check for advanced indexing: # https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing # Do the advanced indexing axes appear contiguo...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _static_idx(idx: slice, size: Union[int, Poly]): """Helper function to compute the static slice start/limit/stride values.""" if _any(type(s) is Poly for s in (idx.start, idx.stop, idx.step, size)): start, stop, step = _polymorphic_slice_indices(idx, size) elif isinstance(size, int): sta...
def _static_idx(idx, size): """Helper function to compute the static slice start/limit/stride values.""" assert isinstance(idx, slice) start, stop, step = idx.indices(size) if (step < 0 and stop >= start) or (step > 0 and start >= stop): return 0, 0, 1, False # sliced to size zero if step ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _check_shape(name, shape, *param_shapes): shape = abstract_arrays.canonicalize_shape(shape) if param_shapes: shape_ = lax.broadcast_shapes(shape, *param_shapes) if shape != shape_: msg = ( "{} parameter shapes must be broadcast-compatible with shape " ...
def _check_shape(name, shape, *param_shapes): try: shape = tuple(map(int, shape)) except TypeError as err: msg = "{} requires a concrete tuple of integers as shape argument, got {}." raise ValueError(msg.format(name, shape)) from err if param_shapes: shape_ = lax.broadcast_sh...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def custom_jvp(fwd, jvp): @wraps(fwd) def fun_(*args, **kwargs): args_flat, in_tree = tree_flatten((args, kwargs)) flat_fun, out_data = _flatten_fun_and_count_res(lu.wrap_init(fwd), in_tree) out_flat = custom_jvp_call( flat_fun, *args_flat, out_data=ou...
def custom_jvp(primals, tangents): ans = fun(*primals) tangents_out = [ rule(t, ans, *primals) for rule, t in zip(jvprules, tangents) if rule is not None and t is not ad_util.zero ] return ans, functools.reduce(ad.add_tangents, tangents_out, ad_util.zero)
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def custom_vjp(fwd, bwd): @wraps(fwd) def fun_(*args, **kwargs): args_flat, in_tree = tree_flatten((args, kwargs)) flat_fun, out_data = _flatten_fun_and_count_res(lu.wrap_init(fwd), in_tree) out_flat = custom_vjp_call( flat_fun, *args_flat, bwd=bwd, out_data=out_data, keep_re...
def custom_vjp(*primals): ans = fun(*primals) # TODO(mattjj): avoid instantiating zeros? def vjpfun(ct): return tuple( vjp(ct, ans, *primals) if vjp else ad_util.zeros_like_jaxval(x) for x, vjp in zip(primals, vjprules) ) return ans, vjpfun
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def __repr__(self): return "<axis {}>".format(hex(id(self.obj)))
def __repr__(self): return "<jax.custom_transforms function {fun}>".format(fun=self.__name__)
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def optimal_step_size( last_step, mean_error_ratio, safety=0.9, ifactor=10.0, dfactor=0.2, order=5.0 ): """Compute optimal Runge-Kutta stepsize.""" mean_error_ratio = np.max(mean_error_ratio) dfactor = np.where(mean_error_ratio < 1, 1.0, dfactor) err_ratio = np.sqrt(mean_error_ratio) factor = n...
def optimal_step_size( last_step, mean_error_ratio, safety=0.9, ifactor=10.0, dfactor=0.2, order=5.0 ): """Compute optimal Runge-Kutta stepsize.""" mean_error_ratio = np.max(mean_error_ratio) dfactor = np.where(mean_error_ratio < 1, 1.0, dfactor) err_ratio = np.sqrt(mean_error_ratio) factor = n...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def odeint(ofunc, y0, t, *args, **kwargs): """Adaptive stepsize (Dormand-Prince) Runge-Kutta odeint implementation. Args: ofunc: Function to evaluate `yt = ofunc(y, t, *args)` that returns the time derivative of `y`. y0: initial value for the state. t: Timespan for `ofunc` evaluation ...
def odeint(ofunc, y0, t, *args, **kwargs): """Adaptive stepsize (Dormand-Prince) Runge-Kutta odeint implementation. Args: ofunc: Function to evaluate `yt = ofunc(y, t, *args)` that returns the time derivative of `y`. y0: initial value for the state. t: Timespan for `ofunc` evaluation ...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def _fori_body_fun(i, val): """Internal fori_loop body to interpolate an integral at each timestep.""" t, cur_y, cur_f, cur_t, dt, last_t, interp_coeff, solution = val cur_y, cur_f, cur_t, dt, last_t, interp_coeff, _ = jax.lax.while_loop( lambda x: (x[2] < t[i]) & (x[-1] < mxstep), _while_bo...
def _fori_body_fun(func, i, val): """Internal fori_loop body to interpolate an integral at each timestep.""" t, cur_y, cur_f, cur_t, dt, last_t, interp_coeff, solution = val cur_y, cur_f, cur_t, dt, last_t, interp_coeff, _ = jax.lax.while_loop( lambda x: (x[2] < t[i]) & (x[-1] < mxstep), fun...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def _while_body_fun(x): """Internal while_loop body to determine interpolation coefficients.""" cur_y, cur_f, cur_t, dt, last_t, interp_coeff, j = x next_t = cur_t + dt next_y, next_f, next_y_error, k = runge_kutta_step(func, cur_y, cur_f, cur_t, dt) error_ratios = error_ratio(next_y_error, rtol, at...
def _while_body_fun(func, x): """Internal while_loop body to determine interpolation coefficients.""" cur_y, cur_f, cur_t, dt, last_t, interp_coeff, j = x next_t = cur_t + dt next_y, next_f, next_y_error, k = runge_kutta_step(func, cur_y, cur_f, cur_t, dt) error_ratios = error_ratio(next_y_error, rt...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def vjp_odeint(ofunc, y0, t, *args, **kwargs): """Return a function that calculates `vjp(odeint(func(y, t, *args))`. Args: ofunc: Function `ydot = ofunc(y, t, *args)` to compute the time derivative of `y`. y0: initial value for the state. t: Timespan for `ofunc` evaluation like `np.li...
def vjp_odeint(ofunc, y0, t, *args, **kwargs): """Return a function that calculates `vjp(odeint(func(y, t, *args))`. Args: ofunc: Function `ydot = ofunc(y, t, *args)` to compute the time derivative of `y`. y0: initial value for the state. t: Timespan for `ofunc` evaluation like `np.li...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def vjp_all(g, yt, t): """Calculate the VJP g * Jac(odeint(ofunc, y0, t, *args)).""" rev_yt = yt[-1::-1, :] rev_t = t[-1::-1] rev_tarray = -np.array([t[-1:0:-1], t[-2::-1]]).T rev_gi = g[-1::-1, :] vjp_y = g[-1, :] vjp_t0 = 0.0 vjp_args = np.zeros_like(flat_args) time_vjp_list = np....
def vjp_all(g, yt, t): """Calculate the VJP g * Jac(odeint(ofunc, y0, t, *args)).""" rev_yt = yt[-1::-1, :] rev_t = t[-1::-1] rev_tarray = -np.array([t[-1:0:-1], t[-2::-1]]).T rev_gi = g[-1::-1, :] vjp_y = g[-1, :] vjp_t0 = 0.0 vjp_args = np.zeros_like(flat_args) time_vjp_list = np....
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def build_odeint(ofunc, rtol=1.4e-8, atol=1.4e-8, mxstep=np.inf): """Return `f(y0, t, args) = odeint(ofunc(y, t, *args), y0, t, args)`. Given the function ofunc(y, t, *args), return the jitted function `f(y0, t, args) = odeint(ofunc(y, t, *args), y0, t, args)` with the VJP of `f` defined using `vjp_ode...
def build_odeint(ofunc, rtol=1.4e-8, atol=1.4e-8, mxstep=onp.inf): """Return `f(y0, t, args) = odeint(ofunc(y, t, *args), y0, t, args)`. Given the function ofunc(y, t, *args), return the jitted function `f(y0, t, args) = odeint(ofunc(y, t, *args), y0, t, args)` with the VJP of `f` defined using `vjp_od...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def my_odeint_jacrev(fun): """Calculate the Jacobian of an odeint.""" @jax.jit def _jacfun(*args, **kwargs): ys, pullback = vjp_odeint(fun, *args, **kwargs) my_jac = jax.vmap(pullback)(jax.api._std_basis(ys)) my_jac = jax.api.tree_map( partial(jax.api._unravel_array_into...
def my_odeint_jacrev(fun): """Calculate the Jacobian of an odeint.""" @jax.jit def _jacfun(*args, **kwargs): ys, pullback = vjp_odeint(fun, *args, **kwargs) my_jac = jax.vmap(pullback)(jax.api._std_basis(ys)) my_jac = jax.api.tree_map( functools.partial(jax.api._unravel_...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def _jacfun(*args, **kwargs): ys, pullback = vjp_odeint(fun, *args, **kwargs) my_jac = jax.vmap(pullback)(jax.api._std_basis(ys)) my_jac = jax.api.tree_map( partial(jax.api._unravel_array_into_pytree, ys, 0), my_jac ) my_jac = jax.api.tree_transpose( jax.api.tree_structure(args), jax...
def _jacfun(*args, **kwargs): ys, pullback = vjp_odeint(fun, *args, **kwargs) my_jac = jax.vmap(pullback)(jax.api._std_basis(ys)) my_jac = jax.api.tree_map( functools.partial(jax.api._unravel_array_into_pytree, ys, 0), my_jac ) my_jac = jax.api.tree_transpose( jax.api.tree_structure(...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def pend_benchmark_odeint(): _, _ = benchmark_odeint( pend, (np.pi - 0.1, 0.0), np.linspace(0.0, 10.0, 101), 0.25, 9.8 )
def pend_benchmark_odeint(): _, _ = benchmark_odeint( pend, (onp.pi - 0.1, 0.0), onp.linspace(0.0, 10.0, 101), 0.25, 9.8 )
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def batch(fun, in_vals, in_dims, out_dim_dests): # executes a batched version of `fun` following out_dim_dests batched_fun = batch_fun(fun, in_dims, out_dim_dests) return batched_fun.call_wrapped(*in_vals)
def batch(fun, in_vals, in_dims, out_dim_dests): (size,) = {x.shape[d] for x, d in zip(in_vals, in_dims) if d is not not_mapped} out_vals, out_dims = batch_fun(fun, in_vals, in_dims) return map(partial(matchaxis, size), out_dims, out_dim_dests(), out_vals)
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def batch_subtrace(master, in_dims, *in_vals, **params): trace = BatchTrace(master, core.cur_sublevel()) in_tracers = [ BatchTracer(trace, val, dim) if dim is not None else val for val, dim in zip(in_vals, in_dims) ] outs = yield in_tracers, params out_tracers = map(trace.full_raise,...
def batch_subtrace(master, in_dims, *in_vals): trace = BatchTrace(master, core.cur_sublevel()) in_tracers = [ BatchTracer(trace, val, dim) if dim is not None else val for val, dim in zip(in_vals, in_dims) ] outs = yield in_tracers, {} out_tracers = map(trace.full_raise, outs) out...
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def batch_fun(fun, in_dims, out_dim_dests): # transformation version of batch, which doesn't call the function fun, out_dims = batch_subtrace(fun) return _batch_fun(fun, in_dims, out_dims, out_dim_dests)
def batch_fun(fun, in_vals, in_dims): with new_master(BatchTrace) as master: fun, out_dims = batch_subtrace(fun, master, in_dims) out_vals = fun.call_wrapped(*in_vals) del master return out_vals, out_dims()
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def partial_eval_wrapper(avals, *consts): py_args = (map(PartialVal, zip(avals, consts)),) jaxpr, (out_pvals, consts, env) = yield py_args, {} out_pvs, out_consts = unzip2(out_pvals) out = tuple(out_consts) + tuple(consts) yield out, (out_pvs, jaxpr, env)
def partial_eval_wrapper(avals, *consts): py_args = (map(PartialVal, zip(avals, consts)),) jaxpr, (out_pvals, consts, env) = yield py_args, {} out_pvs, out_consts = unzip2(out_pvals) out = tuple(out_consts) + tuple(consts) # TODO: can consts be traced? yield out, (out_pvs, jaxpr, env)
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def _jvp_slogdet(g, ans, x): if np.issubdtype(np._dtype(x), np.complexfloating): raise NotImplementedError # TODO(pfau): make this work for complex types jvp_logdet = np.trace(solve(x, g), axis1=-1, axis2=-2) return ad_util.zero, jvp_logdet
def _jvp_slogdet(g, ans, x): jvp_sign = np.zeros(x.shape[:-2]) jvp_logdet = np.trace(solve(x, g), axis1=-1, axis2=-2) return jvp_sign, jvp_logdet
https://github.com/google/jax/issues/1097
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-91-eb0f4b094a7d> in <module>() 12 args = ([1.0, {}],) 13 print(identity(args)) ---> 14 jax.jvp(identity, args, args) /usr/local/lib/python3.6/dist-packa...
TypeError
def vmap(fun: Callable, in_axes=0, out_axes=0): """Vectorizing map. Creates a function which maps `fun` over argument axes. Args: fun: Function to be mapped over additional axes. in_axes: A nonnegative integer, None, or (nested) standard Python container (tuple/list/dict) thereof specifying...
def vmap(fun: Callable, in_axes=0, out_axes=0): """Vectorizing map. Creates a function which maps `fun` over argument axes. Args: fun: Function to be mapped over additional axes. in_axes: A nonnegative integer, None, or (nested) standard Python container (tuple/list/dict) thereof specifying...
https://github.com/google/jax/issues/2367
ValueError: Expected list, got (([<object object at 0x7fcb21ef58b0>, <object object at 0x7fcb21ef58b0>, <object object at 0x7fcb21ef58b0>, <object object at 0x7fcb21ef58b0>, <object object at 0x7fcb21ef58b0>, <object object at 0x7fcb21ef58b0>], <object object at 0x7fcb21ef58b0>), <object object at 0x7fcb21ef58b0>, <obj...
ValueError
def backward_pass(jaxpr: core.Jaxpr, consts, args, cotangents_in): if all(ct is zero for ct in cotangents_in): return [zero] * len(jaxpr.invars) def write_cotangent(v, ct): # assert v not in primal_env if ct is not None and type(v) is not Literal: ct_env[v] = add_tangents(ct...
def backward_pass(jaxpr: core.Jaxpr, consts, args, cotangents_in): if all(ct is zero for ct in cotangents_in): return [zero] * len(jaxpr.invars) def write_cotangent(v, ct): # assert v not in primal_env if ct is not None and type(v) is not Literal: ct_env[v] = add_tangents(ct...
https://github.com/google/jax/issues/2180
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-16-3143f2d8c2b3> in <module>() 11 x = jnp.ones([1, 1, 1]) 12 f = jax.remat(f) ---> 13 jax.grad(f)(w, x) 17 frames google3/third_party/py/jax/interpreter...
AssertionError
def _eval_primals(jaxpr, args): primal_env = {} def read_primal(v): if type(v) is Literal: return v.val else: return primal_env.get(v, undefined_primal) def write_primal(v, val): if val is not undefined_primal: primal_env[v] = val def is_lin...
def _eval_primals(jaxpr, args): primal_env = {} def read_primal(v): if type(v) is Literal: return v.val else: return primal_env.get(v, undefined_primal) def write_primal(v, val): if val is not undefined_primal: primal_env[v] = val def is_lin...
https://github.com/google/jax/issues/2180
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-16-3143f2d8c2b3> in <module>() 11 x = jnp.ones([1, 1, 1]) 12 f = jax.remat(f) ---> 13 jax.grad(f)(w, x) 17 frames google3/third_party/py/jax/interpreter...
AssertionError
def _scan_transpose(cts, *args, forward, length, num_consts, num_carry, jaxpr, linear): # we've only implemented transposing scans with specific lin/nonlin patterns consts_lin, init_lin, xs_lin = split_list(linear, [num_consts, num_carry]) num_ires = len(consts_lin) - sum(consts_lin) num_eres = len(xs_l...
def _scan_transpose(cts, *args, forward, length, num_consts, num_carry, jaxpr, linear): # we've only implemented transposing scans with specific lin/nonlin patterns consts_lin, init_lin, xs_lin = split_list(linear, [num_consts, num_carry]) num_ires = len(consts_lin) - sum(consts_lin) num_eres = len(xs_l...
https://github.com/google/jax/issues/2180
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-16-3143f2d8c2b3> in <module>() 11 x = jnp.ones([1, 1, 1]) 12 f = jax.remat(f) ---> 13 jax.grad(f)(w, x) 17 frames google3/third_party/py/jax/interpreter...
AssertionError
def sign(x): r"""Elementwise sign. For floating-point inputs, returns :math:`\mathrm{sign}(x) = \begin{cases} -1 & x < 0\\ -0 & x = -0\\ \mathit{NaN} & x = \mathit{NaN}\\ +0 & x = +0\\ 1 & x > 0 \end{cases}` For signed integer inputs, returns :math:`\mathrm{sign}(x) = \begin{cases} -1 & x < ...
def sign(x): r"""Elementwise sign. :math:`\mathrm{sign}(x) = \begin{cases} -1 & x < 0\\ -0 & x = -0\\ \mathit{NaN} & x = \mathit{NaN}\\ +0 & x = +0\\ 1 & x > 0 \end{cases}`. """ return sign_p.bind(x)
https://github.com/google/jax/issues/1933
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/jax/interpreters/xla.py in primitive_computation(prim, *avals, **params) 179 try: --> 180 return c.Build() 181 except Run...
RuntimeError
def unop(result_dtype, accepted_dtypes, name, translation_rule=None): dtype_rule = partial(unop_dtype_rule, result_dtype, accepted_dtypes, name) prim = standard_primitive( _attrgetter("shape"), dtype_rule, name, translation_rule=translation_rule ) batching.defvectorized(prim) masking.defvect...
def unop(result_dtype, accepted_dtypes, name): dtype_rule = partial(unop_dtype_rule, result_dtype, accepted_dtypes, name) prim = standard_primitive(_attrgetter("shape"), dtype_rule, name) batching.defvectorized(prim) masking.defvectorized(prim) return prim
https://github.com/google/jax/issues/1933
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/jax/interpreters/xla.py in primitive_computation(prim, *avals, **params) 179 try: --> 180 return c.Build() 181 except Run...
RuntimeError
def __getitem__(self, idx): if self._npy_value is None and type(idx) is int: ids = self._ids() device_buffer = self.device_buffers[ids[idx]] aval = ShapedArray(self.aval.shape[1:], self.aval.dtype) handler = xla.aval_to_result_handler(None, aval) return handler(device_buffer)...
def __getitem__(self, idx): if self._npy_value is None and type(idx) is int: ids = self._ids() device_buffer = self.device_buffers[ids[idx]] aval = ShapedArray(self.aval.shape[1:], self.aval.dtype) handler = xla.aval_to_result_handler(aval) return handler(device_buffer) e...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def aval_to_result_handler(device, aval): try: return xla_result_handlers[type(aval)](device, aval) except KeyError: raise TypeError("No xla_result_handler for type: {}".format(type(aval)))
def aval_to_result_handler(aval): try: return xla_result_handlers[type(aval)](aval) except KeyError: raise TypeError("No xla_result_handler for type: {}".format(type(aval)))
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def array_result_handler(device, aval): return partial(DeviceArray, raise_to_shaped(aval), device)
def array_result_handler(aval): return partial(DeviceArray, raise_to_shaped(aval))
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def xla_primitive_callable(prim, *arg_specs, **params): avals, arg_devices = unzip2(arg_specs) device = _device_from_arg_devices(arg_devices) backend = xb.get_device_backend(device) aval_out = prim.abstract_eval(*avals, **params) if not prim.multiple_results: handle_result = aval_to_result_h...
def xla_primitive_callable(prim, *arg_specs, **params): avals, devices = unzip2(arg_specs) # TODO(mattjj): make Device hashable instead of handling pairs here try: (device,) = set(d for d in devices if d is not None) or (None,) except ValueError: msg = "primitive arguments must be coloca...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def _xla_call_impl(fun, *args, **params): device = params["device"] backend = params["backend"] compiled_fun = _xla_callable(fun, device, backend, *map(arg_spec, args)) try: return compiled_fun(*args) except FloatingPointError: print( "Invalid value encountered in the out...
def _xla_call_impl(fun, *args, **params): device = params["device"] backend = params["backend"] compiled_fun = _xla_callable(fun, device, backend, *map(abstractify, args)) try: return compiled_fun(*args) except FloatingPointError: print( "Invalid value encountered in the ...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def _xla_callable(fun, device, backend, *arg_specs): if device is not None and backend is not None: raise ValueError( "can't specify both a device and a backend for jit, " "got device={} and backend={}".format(device, backend) ) abstract_args, arg_devices = unzip2(arg_sp...
def _xla_callable(fun, device, backend, *abstract_args): pvals = [pe.PartialVal((aval, core.unit)) for aval in abstract_args] with core.new_master(pe.StagingJaxprTrace, True) as master: jaxpr, (pvals, consts, env) = pe.trace_to_subjaxpr( fun, master, False ).call_wrapped(pvals) ...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def _pval_to_result_handler(device, pval): pv, const = pval if pv is None: return lambda _: const else: return aval_to_result_handler(device, pv)
def _pval_to_result_handler(pval): pv, const = pval if pv is None: return lambda _: const else: return aval_to_result_handler(pv)
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def __init__(self, aval, device, device_buffer): self.aval = aval self.device_buffer = device_buffer self._device = device and (type(device), device.id) self._npy_value = None if not core.skip_checks: assert type(aval) is ShapedArray npy_value = self._value assert npy_value....
def __init__(self, aval, device_buffer): self.aval = aval self.device_buffer = device_buffer # TODO(mattjj): make Device hashable device = device_buffer.device() self._device = device and (type(device), device.id) self._npy_value = None if not core.skip_checks: assert type(aval) is ...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def _device_put_impl(x, device=None): try: a = abstractify(x) except TypeError: raise TypeError( "Argument '{}' of type {} is not a valid JAX type".format(x, type(x)) ) handler = aval_to_result_handler(device, a) return handler(device_put(x, device))
def _device_put_impl(x, device=None): try: a = abstractify(x) except TypeError: raise TypeError( "Argument '{}' of type {} is not a valid JAX type".format(x, type(x)) ) handler = aval_to_result_handler(a) return handler(device_put(x, device))
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def _instantiate_device_constant(const, device=None, backend=None, cutoff=1e6): # dispatch an XLA Computation to build the constant on the device if it's # large, or alternatively build it on the host and transfer it if it's small assert isinstance(const, DeviceConstant) backend = xb.get_backend(device....
def _instantiate_device_constant(const, device=None, backend=None, cutoff=1e6): # dispatch an XLA Computation to build the constant on the device if it's # large, or alternatively build it on the host and transfer it if it's small assert isinstance(const, DeviceConstant) if const.size > cutoff: ...
https://github.com/google/jax/issues/1914
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-20-ca9775de72ea> in <module>() ----> 1 x / x.shape[0] 4 frames google3/third_party/py/jax/interpreters/xla.py in xla_primitive_callable(prim, *arg_specs...
ValueError
def update(self, name, val): if self.use_absl: setattr(self.absl_flags.FLAGS, name, val) else: self.check_exists(name) if name not in self.values: raise Exception("Unrecognized config option: {}".format(name)) self.values[name] = val
def update(self, name, val): self.check_exists(name) if name not in self.values: raise Exception("Unrecognized config option: {}".format(name)) self.values[name] = val
https://github.com/google/jax/issues/1401
TypeError Traceback (most recent call last) <ipython-input-171-c4c8dbbffe17> in <module> 1 A = np.array([[1.,2.],[2.,3.]]) ----> 2 V,D = np.linalg.eig(A) ~/RESEARCH/jax/jax/numpy/linalg.py in eig(a) 95 def eig(a): 96 a = _promote_arg_dtypes(np.asarray(a)) ---> 97 w, vl, vr = lax_lin...
TypeError
def _execute_compiled_primitive(prim, compiled, backend, result_handler, *args): (device_num,) = compiled.DeviceOrdinals() input_bufs = [device_put(x, device_num, backend=backend) for x in args] out_buf = compiled.Execute(input_bufs) if FLAGS.jax_debug_nans: check_nans(prim, out_buf.destructure(...
def _execute_compiled_primitive(prim, compiled, backend, result_handler, *args): (device_num,) = compiled.DeviceOrdinals() input_bufs = [device_put(x, device_num, backend=backend) for x in args] out_buf = compiled.Execute(input_bufs) if FLAGS.jax_debug_nans: check_nans(prim, out_buf) return ...
https://github.com/google/jax/issues/1401
TypeError Traceback (most recent call last) <ipython-input-171-c4c8dbbffe17> in <module> 1 A = np.array([[1.,2.],[2.,3.]]) ----> 2 V,D = np.linalg.eig(A) ~/RESEARCH/jax/jax/numpy/linalg.py in eig(a) 95 def eig(a): 96 a = _promote_arg_dtypes(np.asarray(a)) ---> 97 w, vl, vr = lax_lin...
TypeError
def _reduction_init_val(a, init_val): a_dtype = xla_bridge.canonicalize_dtype(_dtype(a)) if a_dtype == "bool": return onp.array(init_val > 0, dtype=a_dtype) try: return onp.array(init_val, dtype=a_dtype) except OverflowError: assert onp.issubdtype(a_dtype, onp.integer) si...
def _reduction_init_val(a, init_val): a_dtype = xla_bridge.canonicalize_dtype(_dtype(a)) try: return onp.array(init_val, dtype=a_dtype) except OverflowError: assert onp.issubdtype(a_dtype, onp.integer) sign, iinfo = onp.sign(init_val), onp.iinfo(a_dtype) return onp.array(iinf...
https://github.com/google/jax/issues/1101
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/jax/interpreters/batching.py in get_primitive_batcher(p) 231 try: --> 232 return primitive_batchers[p] 233 except KeyErro...
KeyError
def jaxpr_replicas(jaxpr): return max(it.chain([1], (eqn_replicas(eqn) for eqn in jaxpr.eqns)))
def jaxpr_replicas(jaxpr): nums = (eqn_replicas(eqn) for eqn in jaxpr.eqns if eqn.bound_subjaxprs) return max(it.chain([1], nums)) # max(itr, default=1)
https://github.com/google/jax/issues/1065
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-4-9a3737aed707> in <module>() ----> 1 multi_step_pmap(np.zeros((8,)), count=1) 13 frames <ipython-input-3-8106aee94f86> in multi_step_pmap(state, count)...
AssertionError
def eqn_replicas(eqn): if eqn.bound_subjaxprs: ((subjaxpr, _, _),) = eqn.bound_subjaxprs return eqn.params.get("axis_size", 1) * jaxpr_replicas(subjaxpr) elif eqn.primitive in initial_style_translations: nums = ( jaxpr_replicas(param if type(param) is core.Jaxpr else param.ja...
def eqn_replicas(eqn): ((subjaxpr, _, _),) = eqn.bound_subjaxprs return eqn.params.get("axis_size", 1) * jaxpr_replicas(subjaxpr)
https://github.com/google/jax/issues/1065
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-4-9a3737aed707> in <module>() ----> 1 multi_step_pmap(np.zeros((8,)), count=1) 13 frames <ipython-input-3-8106aee94f86> in multi_step_pmap(state, count)...
AssertionError
def cholesky_cpu_translation_rule(c, operand): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: potrf_output = lapack.jax_potrf(c, operand, lower=True) result = c.GetTupleElement(potrf_output, 0) info = c.Ge...
def cholesky_cpu_translation_rule(c, operand): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: return c.GetTupleElement(lapack.jax_potrf(c, operand, lower=True), 0) else: # Fall back to the HLO implementation f...
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def eig_cpu_translation_rule(c, operand): shape = c.GetShape(operand) batch_dims = shape.dimensions()[:-2] geev_out = lapack.jax_geev(c, operand) w = c.GetTupleElement(geev_out, 0) vl = c.GetTupleElement(geev_out, 1) vr = c.GetTupleElement(geev_out, 2) ok = c.Eq(c.GetTupleElement(geev_out, 3...
def eig_cpu_translation_rule(c, operand): out = lapack.jax_geev(c, operand) return c.Tuple( c.GetTupleElement(out, 0), c.GetTupleElement(out, 1), c.GetTupleElement(out, 2) )
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def eigh_cpu_translation_rule(c, operand, lower): shape = c.GetShape(operand) batch_dims = shape.dimensions()[:-2] syevd_out = lapack.jax_syevd(c, operand, lower=lower) v = c.GetTupleElement(syevd_out, 0) w = c.GetTupleElement(syevd_out, 1) ok = c.Eq(c.GetTupleElement(syevd_out, 2), c.ConstantS3...
def eigh_cpu_translation_rule(c, operand, lower): out = lapack.jax_syevd(c, operand, lower=lower) return c.Tuple(c.GetTupleElement(out, 0), c.GetTupleElement(out, 1))
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def lu_cpu_translation_rule(c, operand): shape = c.GetShape(operand) batch_dims = shape.dimensions()[:-2] getrf_out = lapack.jax_getrf(c, operand) lu = c.GetTupleElement(getrf_out, 0) # Subtract 1 from the pivot to get 0-based indices. pivot = c.Sub(c.GetTupleElement(getrf_out, 1), c.ConstantS32...
def lu_cpu_translation_rule(c, operand): shape = c.GetShape(operand) dtype = shape.element_type().type out = lapack.jax_getrf(c, operand) lu = c.GetTupleElement(out, 0) # Subtract 1 from the pivot to get 0-based indices. pivot = c.Sub(c.GetTupleElement(out, 1), c.ConstantS32Scalar(1)) # Thro...
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def svd_cpu_translation_rule(c, operand, full_matrices, compute_uv): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: gesdd_out = lapack.jax_gesdd( c, operand, full_matrices=full_matrices, compute_uv=compute_uv ...
def svd_cpu_translation_rule(c, operand, full_matrices, compute_uv): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: out = lapack.jax_gesdd( c, operand, full_matrices=full_matrices, compute_uv=compute_uv ...
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def cholesky_cpu_translation_rule(c, operand): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: potrf_output = lapack.jax_potrf(c, operand, lower=True) result = c.GetTupleElement(potrf_output, 0) info = c.Ge...
def cholesky_cpu_translation_rule(c, operand): shape = c.GetShape(operand) dtype = shape.element_type().type if len(shape.dimensions()) == 2 and dtype in _cpu_lapack_types: potrf_output = lapack.jax_potrf(c, operand, lower=True) result = c.GetTupleElement(potrf_output, 0) info = c.Ge...
https://github.com/google/jax/issues/775
/home/luke/.local/lib/python3.5/site-packages/jax/scipy/linalg.py:36: UserWarning: scipy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) [[0. 1. 2.] [0. 4. 5.] [0. 0. 8.]] From Scipy Traceback (most recent call last): File "tmp.py", line 11, in <module>...
numpy.linalg.LinAlgError
def _wrap_hashably(arg): try: hash(arg) except TypeError: return WrapHashably(arg) # e.g. ndarrays, DeviceArrays else: return Hashable(arg)
def _wrap_hashably(arg): try: hash(arg) except TypeError: return WrapHashably(arg) else: return Hashable(arg)
https://github.com/google/jax/issues/883
Traceback (most recent call last): File "<ipython-input-7-563ff9ef5fe4>", line 1, in <module> runfile('/home/hpc/capm/sn0523/SIR/minExample.py', wdir='/home/hpc/capm/sn0523/SIR') File "/home/hpc/capm/sn0523/jax/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile execfile(fil...
ValueError
def __hash__(self): raise TypeError("JAX DeviceArray, like numpy.ndarray, is not hashable.")
def __hash__(self): # TODO(mattjj): this is not semantically correct because it is possible # __eq__ is true for values with unequal __hash__ values. However, the # main use case at the moment is memoization for which false negatives are # fine. return id(self)
https://github.com/google/jax/issues/883
Traceback (most recent call last): File "<ipython-input-7-563ff9ef5fe4>", line 1, in <module> runfile('/home/hpc/capm/sn0523/SIR/minExample.py', wdir='/home/hpc/capm/sn0523/SIR') File "/home/hpc/capm/sn0523/jax/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile execfile(fil...
ValueError
def _conv_transpose_padding(k, s, padding): """Calculate before and after padding for a dim of transposed convolution. Args: k: int: kernel dimension. s: int: dimension stride value. padding: 'same' or 'valid' padding mode for original forward conv. Returns: 2-tuple: ints: before a...
def _conv_transpose_padding(k, s, padding): """Calculate before and after padding for a dim of transposed convolution. Args: k: int: kernel dimension. s: int: dimension stride value. padding: 'same' or 'valid' padding mode for original forward conv. Returns: 2-tuple: ints: before a...
https://github.com/google/jax/issues/883
Traceback (most recent call last): File "<ipython-input-7-563ff9ef5fe4>", line 1, in <module> runfile('/home/hpc/capm/sn0523/SIR/minExample.py', wdir='/home/hpc/capm/sn0523/SIR') File "/home/hpc/capm/sn0523/jax/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile execfile(fil...
ValueError
def arange(*args, **kwargs): dtype = kwargs.get("dtype", None) if not args: raise TypeError( "Required argument 'start' (pos 1) not found" ) # same as numpy error # If called like np.arange(N), we create a lazy lax._IotaConstant. if len(args) == 1 and not kwargs: (s...
def arange(*args, **kwargs): dtype = kwargs.pop("dtype", None) if not args: raise TypeError( "Required argument 'start' (pos 1) not found" ) # same as numpy error # If called like np.arange(N), we create a lazy lax._IotaConstant. if len(args) == 1 and not kwargs: (s...
https://github.com/google/jax/issues/830
int64 --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-12-5b101f76f4c3> in <module>() 1 a = np.arange(4, dtype=np.complex64) 2 print(a.dtype) ----> 3 assert a.dtype is np.complex64 AssertionError:
AssertionError
def _scatter_add_transpose_rule( t, operand, scatter_indices, updates, update_jaxpr, update_consts, dimension_numbers, updates_shape, ): assert scatter_indices is not None if t is ad_util.zero: return [ad_util.zero, None, ad_util.zero] operand_t = update_t = None ...
def _scatter_add_transpose_rule( t, operand, scatter_indices, updates, update_jaxpr, update_consts, dimension_numbers, updates_shape, ): assert scatter_indices is not None operand_t = update_t = None if operand is None: operand_t = t if updates is None: g...
https://github.com/google/jax/issues/776
Traceback (most recent call last): File "/usr/local/google/home/schsam/.local/lib/python2.7/site-packages/absl/third_party/unittest3_backport/case.py", line 37, in testPartExecutor yield File "/usr/local/google/home/schsam/.local/lib/python2.7/site-packages/absl/third_party/unittest3_backport/case.py", line 162, in run...
AttributeError
def tensordot(a, b, axes=2): _check_arraylike("tensordot", a, b) if not (ndim(a) >= 1 and ndim(b) >= 1): msg = "tensordot requires a.ndim and b.dim to be at least 1, got {} and {}." raise TypeError(msg.format(ndim(a), ndim(b))) if type(axes) is int: if axes == 0: a, b = ...
def tensordot(a, b, axes=2): _check_arraylike("tensordot", a, b) if not (ndim(a) >= 1 and ndim(b) >= 1): msg = "tensordot requires a.ndim and b.dim to be at least 1, got {} and {}." raise TypeError(msg.format(ndim(a), ndim(b))) if type(axes) is int: a, b = _promote_dtypes(a, b) ...
https://github.com/google/jax/issues/740
result = np.tensordot(np.ones((2, 3, 4)), np.ones((5, 6, 7)), 0) /usr/local/google/home/chaseriley/.local/lib/python3.6/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "/usr/local...
RuntimeError
def trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None): if out: raise NotImplementedError("The 'out' argument to trace is not supported.") axis1 = axis1 % ndim(a) axis2 = axis2 % ndim(a) a_shape = shape(a) if dtype is None: dtype = _dtype(a) if issubdtype(dtype, int...
def trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None): if out: raise NotImplementedError("The 'out' argument to trace is not supported.") a_shape = shape(a) if dtype is None: dtype = _dtype(a) if issubdtype(dtype, integer): default_int = xla_bridge.canonicalize_...
https://github.com/google/jax/issues/738
print(np.trace(np.ones((2, 3, 4, 4)), axis1=-1, axis2=-2)) Traceback (most recent call last): File "/usr/local/google/home/chaseriley/.local/lib/python3.6/site-packages/jax/interpreters/xla.py", line 70, in primitive_computation return c.Build() File "/usr/local/google/home/chaseriley/.local/lib/python3.6/site-packages...
RuntimeError
def partial_eval(f, trace, pvs): f = trace_to_subjaxpr(f, trace.master, False) return partial_eval_wrapper(f, tuple(pvs))
def partial_eval(f, trace, pvs): f = trace_to_subjaxpr(f, trace.master) return partial_eval_wrapper(f, tuple(pvs))
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def trace_to_jaxpr(fun, pvals, **kwargs): """Traces a function, given abstract inputs, to a jaxpr.""" instantiate = kwargs.pop("instantiate", False) with new_master(JaxprTrace) as master: fun = trace_to_subjaxpr(fun, master, instantiate) jaxpr, (out_pval, consts, env) = fun.call_wrapped(pval...
def trace_to_jaxpr(fun, pvals): """Traces a function, given abstract inputs, to a jaxpr.""" with new_master(JaxprTrace) as master: fun = trace_to_subjaxpr(fun, master) jaxpr, (out_pval, consts, env) = fun.call_wrapped(pvals) assert not env del master return jaxpr, out_pval, ...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def trace_to_subjaxpr(master, instantiate, pvals): assert all([isinstance(pv, PartialVal) for pv in pvals]), pvals trace = JaxprTrace(master, core.cur_sublevel()) in_tracers = map(trace.new_arg, pvals) out_tracer = yield in_tracers, {} out_tracer = trace.full_raise(out_tracer) if instantiate: ...
def trace_to_subjaxpr(master, pvals): assert all([isinstance(pv, PartialVal) for pv in pvals]), pvals trace = JaxprTrace(master, core.cur_sublevel()) in_tracers = map(trace.new_arg, pvals) out_tracer = yield in_tracers, {} out_tracer = trace.full_raise(out_tracer) jaxpr, consts, env = tracers_to...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def compiled_call_impl(fun, *args): with new_master(JaxprTrace, True) as master: pvals = map(abstractify, args) jaxpr, (pval, consts, env) = trace_to_subjaxpr(fun, master, False).call_wrapped( pvals ) jaxpr_ans = eval_jaxpr_raw(jaxpr, consts, env, *args) ans = mer...
def compiled_call_impl(fun, *args): with new_master(JaxprTrace, True) as master: pvals = map(abstractify, args) jaxpr, (pval, consts, env) = trace_to_subjaxpr(fun, master).call_wrapped(pvals) jaxpr_ans = eval_jaxpr_raw(jaxpr, consts, env, *args) ans = merge_pvals(jaxpr_ans, pval) ...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def parallel_callable(fun, axis_name, axis_size, *avals): pvals = [PartialVal((aval, core.unit)) for aval in avals] with core.new_master(JaxprTrace, True) as master: jaxpr, (pval, consts, env) = trace_to_subjaxpr(fun, master, False).call_wrapped( pvals ) assert not env ...
def parallel_callable(fun, axis_name, axis_size, *avals): pvals = [PartialVal((aval, core.unit)) for aval in avals] with core.new_master(JaxprTrace, True) as master: jaxpr, (pval, consts, env) = trace_to_subjaxpr(fun, master).call_wrapped(pvals) assert not env out = compile_replicated(ja...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def xla_callable(fun, *abstract_args): pvals = [pe.PartialVal((aval, core.unit)) for aval in abstract_args] with core.new_master(pe.JaxprTrace, True) as master: jaxpr, (pval, consts, env) = pe.trace_to_subjaxpr( fun, master, False ).call_wrapped(pvals) assert not env # no su...
def xla_callable(fun, *abstract_args): pvals = [pe.PartialVal((aval, core.unit)) for aval in abstract_args] with core.new_master(pe.JaxprTrace, True) as master: jaxpr, (pval, consts, env) = pe.trace_to_subjaxpr(fun, master).call_wrapped( pvals ) assert not env # no subtraces...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def while_loop(cond_fun, body_fun, init_val): """Call `body_fun` repeatedly in a loop while `cond_fun` is True. Arguments: cond_fun: pure function of type `T -> Bool`. body_fun: pure function of type `T -> T`. init_val: value of type `T`, a type that can be a scalar, array, or any (ne...
def while_loop(cond_fun, body_fun, init_val): """Call `body_fun` repeatedly in a loop while `cond_fun` is True. Arguments: cond_fun: pure function of type `T -> Bool`. body_fun: pure function of type `T -> T`. init_val: value of type `T`, a type that can be a scalar, array, or any (ne...
https://github.com/google/jax/issues/649
$ python loop.py /usr/local/google/home/phawkins/p/jax/jax/lib/xla_bridge.py:144: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "loop.py", line 11, in <module> print(lax.while_loop(cond, body, (33, 4))) File "/usr/loca...
RuntimeError
def atleast_1d(*arys): if len(arys) == 1: arr = array(arys[0]) return arr if ndim(arr) >= 1 else reshape(arr, -1) else: return [atleast_1d(arr) for arr in arys]
def atleast_1d(*arys): if len(arys) == 1: arr = array(arys[0]) return arr if arr.ndim >= 1 else arr.reshape(-1) else: return [atleast_1d(arr) for arr in arys]
https://github.com/google/jax/issues/634
In [3]: onp.atleast_1d(1) Out[3]: array([1]) In [4]: np.atleast_1d(1) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-84084c6642da> in <module> ----> 1 np.atleast_1d(1) ~/src/jax/jax/numpy/lax_nump...
AttributeError
def atleast_2d(*arys): if len(arys) == 1: arr = array(arys[0]) return arr if ndim(arr) >= 2 else reshape(arr, (1, -1)) else: return [atleast_2d(arr) for arr in arys]
def atleast_2d(*arys): if len(arys) == 1: arr = array(arys[0]) return arr if arr.ndim >= 2 else arr.reshape((1, -1)) else: return [atleast_2d(arr) for arr in arys]
https://github.com/google/jax/issues/634
In [3]: onp.atleast_1d(1) Out[3]: array([1]) In [4]: np.atleast_1d(1) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-84084c6642da> in <module> ----> 1 np.atleast_1d(1) ~/src/jax/jax/numpy/lax_nump...
AttributeError
def atleast_3d(*arys): if len(arys) == 1: arr = array(arys[0]) if ndim(arr) <= 1: arr = reshape(arr, (1, -1, 1)) elif ndim(arr) == 2: arr = reshape(arr, shape(arr) + (1,)) return arr else: return [atleast_3d(arr) for arr in arys]
def atleast_3d(*arys): if len(arys) == 1: arr = array(arys[0]) if ndim(arr) <= 1: arr = arr.reshape((1, -1, 1)) elif ndim(arr) == 2: arr = arr.reshape(shape(arr) + (1,)) return arr else: return [atleast_3d(arr) for arr in arys]
https://github.com/google/jax/issues/634
In [3]: onp.atleast_1d(1) Out[3]: array([1]) In [4]: np.atleast_1d(1) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-84084c6642da> in <module> ----> 1 np.atleast_1d(1) ~/src/jax/jax/numpy/lax_nump...
AttributeError
def _brcast(x, *others): # Used in jvprules to make binop broadcasting explicit for transposability. # Requires shape info during jvp tracing, which isn't strictly necessary. # We don't need full numpy broadcasting, but otherwise the logic is the same # so we reuse the broadcast_shapes function after fi...
def _brcast(x, *others): # used in jvprules to make binop broadcasting explicit for transposability. # requires shape info during jvp tracing, which isn't strictly necessary. shapes = list(filter(None, map(onp.shape, (x,) + others))) shape = tuple(shapes and onp.max(shapes, axis=0)) if onp.shape(x) ...
https://github.com/google/jax/issues/354
/usr/local/lib/python2.7/dist-packages/jax/numpy/linalg.py:53: UserWarning: numpy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) /usr/local/lib/python2.7/dist-packages/jax/lib/xla_bridge.py:146: UserWarning: No GPU found, falling back to CPU. warnings....
TypeError
def _dot_general_shape_rule(lhs, rhs, dimension_numbers): (lhs_contracting, rhs_contracting), (lhs_batch, rhs_batch) = dimension_numbers if len(lhs_batch) != len(rhs_batch): msg = ( "dot_general requires equal numbers of lhs_batch and rhs_batch " "dimensions, got lhs_batch {} and...
def _dot_general_shape_rule(lhs, rhs, dimension_numbers): (lhs_contracting, rhs_contracting), (lhs_batch, rhs_batch) = dimension_numbers if len(lhs_batch) != len(rhs_batch): msg = ( "dot_general requires equal numbers of lhs_batch and rhs_batch " "dimensions, got lhs_batch {} and...
https://github.com/google/jax/issues/354
/usr/local/lib/python2.7/dist-packages/jax/numpy/linalg.py:53: UserWarning: numpy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) /usr/local/lib/python2.7/dist-packages/jax/lib/xla_bridge.py:146: UserWarning: No GPU found, falling back to CPU. warnings....
TypeError
def cholesky(x, symmetrize_input=True): if symmetrize_input: x = symmetrize(x) return cholesky_p.bind(x)
def cholesky(x): return cholesky_p.bind(x)
https://github.com/google/jax/issues/354
/usr/local/lib/python2.7/dist-packages/jax/numpy/linalg.py:53: UserWarning: numpy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) /usr/local/lib/python2.7/dist-packages/jax/lib/xla_bridge.py:146: UserWarning: No GPU found, falling back to CPU. warnings....
TypeError
def cholesky_jvp_rule(primals, tangents): (x,) = primals (sigma_dot,) = tangents L = cholesky_p.bind(x) # Forward-mode rule from https://arxiv.org/pdf/1602.07527.pdf phi = lambda X: np.tril(X) / (1 + np.eye(X.shape[-1], dtype=X.dtype)) tmp = triangular_solve(L, sigma_dot, left_side=False, trans...
def cholesky_jvp_rule(primals, tangents): (x,) = primals (sigma_dot,) = tangents L = cholesky_p.bind(x) # Forward-mode rule from https://arxiv.org/pdf/1602.07527.pdf sigma_dot = (sigma_dot + _T(sigma_dot)) / 2 phi = lambda X: np.tril(X) / (1 + np.eye(x.shape[-1])) tmp = triangular_solve(L, ...
https://github.com/google/jax/issues/354
/usr/local/lib/python2.7/dist-packages/jax/numpy/linalg.py:53: UserWarning: numpy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) /usr/local/lib/python2.7/dist-packages/jax/lib/xla_bridge.py:146: UserWarning: No GPU found, falling back to CPU. warnings....
TypeError
def cholesky(a, lower=False, overwrite_a=False, check_finite=True): warnings.warn(_EXPERIMENTAL_WARNING) del overwrite_a, check_finite a = np_linalg._promote_arg_dtypes(np.asarray(a)) l = lax_linalg.cholesky(a if lower else np.conj(_T(a)), symmetrize_input=False) return l if lower else np.conj(_T(l)...
def cholesky(a, lower=False, overwrite_a=False, check_finite=True): warnings.warn(_EXPERIMENTAL_WARNING) del overwrite_a, check_finite a = np_linalg._promote_arg_dtypes(np.asarray(a)) l = lax_linalg.cholesky(a if lower else np.conj(_T(a))) return l if lower else np.conj(_T(l))
https://github.com/google/jax/issues/354
/usr/local/lib/python2.7/dist-packages/jax/numpy/linalg.py:53: UserWarning: numpy.linalg support is experimental and may cause silent failures or wrong outputs warnings.warn(_EXPERIMENTAL_WARNING) /usr/local/lib/python2.7/dist-packages/jax/lib/xla_bridge.py:146: UserWarning: No GPU found, falling back to CPU. warnings....
TypeError
def _normalize_by_window_size(dims, strides, padding): def rescale(outputs, inputs): one = np.ones(inputs.shape[1:-1], dtype=inputs.dtype) window_sizes = lax.reduce_window(one, 0.0, lax.add, dims, strides, padding) return outputs / window_sizes[..., np.newaxis] return rescale
def _normalize_by_window_size(dims, strides, padding): def rescale(outputs, inputs): one = np.ones(inputs.shape[1:3], dtype=inputs.dtype) window_sizes = lax.reduce_window(one, 0.0, lax.add, dims, strides, padding) return outputs / window_sizes return rescale
https://github.com/google/jax/issues/273
(-1, 16, 16, 3) () Traceback (most recent call last): File "minimal_example.py", line 9, in <module> apply_fun(params, np.zeros((100, 32, 32, 3))) File "/gpfs01/bethge/home/jrauber/PhD/063_jax/jax/jax/experimental/stax.py", line 172, in apply_fun return rescale(out, inputs) if rescale else out File "/gpfs01/bethge/home...
ValueError
def rescale(outputs, inputs): one = np.ones(inputs.shape[1:-1], dtype=inputs.dtype) window_sizes = lax.reduce_window(one, 0.0, lax.add, dims, strides, padding) return outputs / window_sizes[..., np.newaxis]
def rescale(outputs, inputs): one = np.ones(inputs.shape[1:3], dtype=inputs.dtype) window_sizes = lax.reduce_window(one, 0.0, lax.add, dims, strides, padding) return outputs / window_sizes
https://github.com/google/jax/issues/273
(-1, 16, 16, 3) () Traceback (most recent call last): File "minimal_example.py", line 9, in <module> apply_fun(params, np.zeros((100, 32, 32, 3))) File "/gpfs01/bethge/home/jrauber/PhD/063_jax/jax/jax/experimental/stax.py", line 172, in apply_fun return rescale(out, inputs) if rescale else out File "/gpfs01/bethge/home...
ValueError