---
title: thunder.core.baseutils.check
description: >-
  Helper function for raising an error_type (default: RuntimeError) if a boolean
  condition fails.
canonical: >-
  https://lightning.ai/docs/thunder/stable/api-reference/generated/thunder.core.baseutils.check
---
# thunder.core.baseutils.check {#thunder-core-baseutils-check}

### `thunder.core.baseutils.check(cond, s, exception_type=<class 'RuntimeError'>)` {#thunder.core.baseutils.check}

[\[source\]](https://github.com/Lightning-AI/lightning-thunder/blob/0.2.6/thunder/core/baseutils.py#L151-L157)

Helper function for raising an error\_type (default: RuntimeError) if a boolean condition fails.

s is a callable producing a string to avoid string construction if the error check is passed.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

Parameters:

*   **cond** ([_bool_](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) –
    
*   **s** ([_Callable_](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.15)")_\[__\[__\]__,_ [_str_](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")_\]_) –
    
*   **exception\_type** ([_type_](https://docs.python.org/3/builtins/functions.html#type "(in Python v3.15)")_\[_[_Exception_](https://docs.python.org/3/builtins/exceptions.html#Exception "(in Python v3.15)")_\]_) –

---

**Navigation**

- Parent: [Generated](/docs/thunder/0.2.6/api-reference/generated.md)
