MCPcopy Create free account

hub / github.com/google-deepmind/chex / functions

Functions578 in github.com/google-deepmind/chex

Functionassert_tree_shape_prefix
Checks that all ``tree`` leaves' shapes have the same prefix. Args: tree: A tree to check. shape_prefix: An expected shape prefix. Raise
chex/_src/asserts.py:1291
Functionassert_tree_shape_suffix
Checks that all ``tree`` leaves' shapes have the same suffix. Args: tree: A tree to check. shape_suffix: An expected shape suffix. Raise
chex/_src/asserts.py:1332
Functionassert_trees_all_eq_comparator_jittable
Asserts all trees are equal using custom comparator. JIT-friendly.
chex/_src/asserts_internal.py:398
Functionassert_trees_all_equal_shapes_and_dtypes
Checks that trees' leaves have the same shape and dtype. Args: *trees: A sequence of (at least 2) trees to check. Raises: AssertionError
chex/_src/asserts.py:1501
Functionassert_trees_all_equal_sizes
Checks that trees have the same structure and leaves' sizes. Args: *trees: A sequence of (at least 2) trees with array leaves. Raises: A
chex/_src/asserts.py:1471
Functionassert_type
Checks that the type of all inputs matches specified ``expected_types``. If the expected type is a Python type or abstract dtype (e.g. `np.floating
chex/_src/asserts.py:786
Functionbcast_fn
(x)
chex/_src/variants.py:550
Functioncheck_variant_arguments
Raises `ValueError` if `variant_fn` got an unknown argument.
chex/_src/variants.py:357
Methodchex_assert_shape
(array, expected)
chex/_src/asserts_chexify_test.py:106
Functionchex_assertion
Wraps Chex assert functions to control their common behaviour. Extends the assertion to support the following optional auxiliary kwargs: custom
chex/_src/asserts_internal.py:202
Functionclear_trace_counter
Clears Chex traces' counter for ``assert_max_traces`` checks. Use it to isolate unit tests that rely on ``assert_max_traces``, by calling it at t
chex/_src/asserts.py:69
Methodcompat_fn
(x, assertion=assert_compat_fn)
chex/_src/asserts_internal_test.py:124
Functioncreate_deprecated_function_alias
Create a deprecated alias for a function. Example usage: >>> g = create_deprecated_function_alias(f, 'path.f', 'path.g') Args: fun: the de
chex/_src/warnings.py:93
Functiondataclass
JAX-friendly wrapper for :py:func:`dataclasses.dataclass`. This wrapper class registers new dataclasses with JAX so that tree utils operate corre
chex/_src/dataclass.py:94
Functiondeprecation_wrapper
Allows deprecated functions to continue running, with a warning logged.
chex/_src/asserts_internal.py:92
Functiondisable_asserts
Disables all Chex assertions. Use wisely.
chex/_src/asserts.py:47
Methoddummy_wrapper
(fn)
chex/_src/asserts_internal_test.py:31
Methoddummy_wrapper
(fn)
chex/_src/asserts_test.py:186
Functionemplace
(arrays, dtype)
chex/_src/asserts_test.py:43
Functionenable_asserts
Enables Chex assertions.
chex/_src/asserts.py:55
Functionerr_msg_fn
(arr_1, arr_2)
chex/_src/asserts.py:1460
Methodexpected_exc_msg
(x, custom_msg)
chex/_src/asserts_internal_test.py:78
Methodf
(path, x)
chex/_src/dataclass_test.py:393
Methodf
(_)
chex/_src/fake_test.py:158
Methodf_hard_with_sg
(lr, x)
chex/_src/asserts_test.py:1821
Methodfails_for_without_device_variant
(x)
chex/_src/variants_test.py:288
Methodfake_parallel_axis_fn
(x)
chex/_src/fake_test.py:425
Functionfake_pmap_and_jit
Context manager for patching `jax.jit` and `jax.pmap`. This is a convenience function, equivalent to nested `chex.fake_pmap` and `chex.fake_jit`
chex/_src/fake.py:330
Methodfinish
(self)
docs/ext/coverage_check.py:68
Functionflatten
(d)
chex/_src/dataclass.py:302
Methodfn
(op, kwargs, x, y=2.0)
chex/_src/fake_test.py:401
Methodfn
(x, y)
chex/_src/asserts_test.py:100
Methodfn
(arg_0, arg_1)
chex/_src/variants_test.py:564
Methodfn
(arg_0, arg_1, float_arg)
chex/_src/variants_test.py:707
Methodfn
(arg_0, arg_1)
chex/_src/variants_test.py:760
Methodfn
(x, y)
chex/_src/asserts_chexify_test.py:282
Methodfn
(x)
chex/_src/asserts_chexify_test.py:591
Methodfn_0
(arg_0, arg_1, kwarg_0, kwarg_1)
chex/_src/variants_test.py:612
Methodfn_1
(arg_0, arg_1, kwarg_0, kwarg_1)
chex/_src/variants_test.py:623
Methodfn_2
()
chex/_src/asserts_test.py:199
Methodfn_2
(arg_0, arg_1, kwarg_0, kwarg_1)
chex/_src/variants_test.py:634
Methodfn_3
(arg_0, arg_1)
chex/_src/variants_test.py:644
Methodfn_jitted
(x, y)
chex/_src/asserts_test.py:124
Methodfn_static
(arg_0, arg_1)
chex/_src/variants_test.py:838
Functionfn_with_counter
(*args, **kwargs)
chex/_src/variants_test.py:89
Functionfn_without_statics
(*args)
chex/_src/fake.py:168
Functionfn_wrapped
(*args, **kwargs)
chex/_src/variants.py:117
Functionfn_wrapped
(*args, **kwargs)
chex/_src/asserts.py:143
Methodfn_wrapped
(fn, *args)
chex/_src/asserts_internal_test.py:34
Methodfn_wrapped
()
chex/_src/asserts_test.py:189
Methodfoo
(x)
chex/_src/fake_test.py:91
Functionformat_shape_matcher
(shape: TShapeMatcher)
chex/_src/asserts_internal.py:302
Methodfu
(lr, x)
chex/_src/asserts_test.py:1825
Functionget
(x)
chex/_src/variants.py:437
Functionget_err_regex
Constructs a regexp for the exception message. Args: message: an exception message. Returns: Regexp that ensures the message follows the
chex/_src/asserts_internal.py:121
Methodget_outdated_docs
(self)
docs/ext/coverage_check.py:62
Functionget_tracers
Returns a tuple with tracers from a tree.
chex/_src/asserts_internal.py:317
Functionh1
(a, b, c)
chex/_src/warnings_test.py:38
Functionif_args_not_none
Wrap chex assertion to only be evaluated if positional args not `None`.
chex/_src/asserts.py:60
Methodincompat_fn
(x, assertion=assert_incompat_fn)
chex/_src/asserts_internal_test.py:138
Methodinner_fn
(y)
chex/_src/asserts_test.py:210
Methodinner_fn
(x, y)
chex/_src/asserts_chexify_test.py:300
Functionis_traceable
Checks if function is traceable. JAX traces a function when it is wrapped with @jit, @pmap, or @vmap. In other words, this function checks whethe
chex/_src/asserts_internal.py:330
Methodjitted_outer_fn
(x)
chex/_src/asserts_test.py:236
Functionjnp_to_np_array
Converts `jnp.ndarray` to `np.ndarray`.
chex/_src/asserts_internal.py:84
Functionlinkcode_resolve
Resolve a GitHub URL corresponding to Python object.
docs/conf.py:148
Methodlogp1_abs_safe
(x)
chex/_src/asserts_chexify_test.py:224
Methodmake_test
(variant: ChexVariantType)
chex/_src/variants.py:182
Functionnew_fun
(*args, **kwargs)
chex/_src/warnings.py:86
Functionnew_init
(self, *orig_args, **orig_kwargs)
chex/_src/dataclass.py:65
Methodno_fake_parallel_axis_fn
(x)
chex/_src/fake_test.py:416
Functionnum_devices_available
Returns the number of available device of the given type.
chex/_src/asserts_internal.py:306
Methodouter_fn
(x)
chex/_src/asserts_test.py:206
Methodouter_fn
(x, y)
chex/_src/asserts_chexify_test.py:304
Functionparams_product
Generates a cartesian product of `params_lists`. See tests from ``variants_test.py`` for examples of usage. Args: *params_lists: A list of p
chex/_src/variants.py:84
Functionput
(x)
chex/_src/variants.py:413
Functionrestrict_backends
Disallows JAX compilation for certain backends. Args: allowed: Names of backend platforms (e.g. 'cpu' or 'tpu') for which compilation is
chex/_src/restrict_backends.py:64
Methodrun_test_suite
Runs a set of tests for static & value assertions. See `run_test_suite_with_log_abs_fn` for example. Args: make_test_fn: A function th
chex/_src/asserts_chexify_test.py:331
MethodsetUp
(self)
chex/_src/asserts_test.py:82
MethodsetUp
(self)
chex/_src/variants_test.py:381
MethodsetUp
(self)
chex/_src/variants_test.py:737
MethodsetUp
(self)
chex/_src/restrict_backends_test.py:30
FunctionsetUpModule
()
chex/_src/fake_test.py:33
FunctionsetUpModule
()
chex/_src/variants_test.py:52
Functionset_n_cpu_devices
Forces XLA to use `n` CPU threads as host devices. This allows `jax.pmap` to be tested on a single-CPU platform. This utility only takes effect b
chex/_src/fake.py:54
Functionsetup
(app: application.Sphinx)
docs/ext/coverage_check.py:113
Methodsome_method
(self, *args)
chex/_src/dataclass_test.py:103
Methodsome_method
(self, *args)
chex/_src/dataclass_test.py:116
Methodsome_method
(self, *args)
chex/_src/dataclass_test.py:134
Methodtake_by_index_and_div
(x, i, y)
chex/_src/asserts_chexify_test.py:238
Methodtest
(self, *args, **kwargs)
chex/_src/variants.py:185
MethodtestFlattenAndUnflatten
(self, test_type)
chex/_src/dataclass_test.py:219
MethodtestFlattenUpTo
(self, test_type)
chex/_src/dataclass_test.py:235
MethodtestFlattenWithPath
(self, test_type)
chex/_src/dataclass_test.py:244
MethodtestFlattenWithPathUpTo
(self, test_type)
chex/_src/dataclass_test.py:253
MethodtestIsDataclass
(self, test_type)
chex/_src/dataclass_test.py:346
MethodtestMapStructure
(self, test_type)
chex/_src/dataclass_test.py:263
MethodtestMapStructureUpTo
(self, test_type)
chex/_src/dataclass_test.py:276
MethodtestMapStructureWithPath
(self, test_type)
chex/_src/dataclass_test.py:295
MethodtestMapStructureWithPathUpTo
(self, test_type)
chex/_src/dataclass_test.py:309
← previousnext →201–300 of 578, ranked by callers