---
title: "InitSpec"
sidebar_label: "InitSpec"
description: "The clika_runtime.nn InitSpec class."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

How Module.init_weights fills a tree's storage-free slots: kind is 'zeros', 'ones', 'constant' or 'normal'; value the constant; mean and std the normal's; reinit_materialized fills slots that hold storage too, in place; overrides is a list of (key, InitSpec) rows, the first row whose key matches a slot's dotted name winning (a key is an exact dotted name, else a regular expression matched against the whole name). Assign `overrides` as a whole list.

## `kind` (property)

The base fill: 'zeros', 'ones', 'constant' or 'normal'.

## `mean` (property)

The 'normal' mean.

## `overrides` (property)

The (key, InitSpec) rows; assign the whole list.

## `reinit_materialized` (property)

Fill slots that already hold storage too, in place.

## `std` (property)

The 'normal' standard deviation (never negative).

## `value` (property)

The 'constant' fill value.

## `__init__`

```python
__init____init__(self) -> None
```

__init__(self) -> None

## `constant`

```python
constantconstant(value: float) -> clika_runtime._core.nn.InitSpec
```

constant(value: float) -> clika_runtime._core.nn.InitSpec

constant(value) -> InitSpec

Every slot `value`.

## `normal`

```python
normalnormal(mean: float, std: float) -> clika_runtime._core.nn.InitSpec
```

normal(mean: float, std: float) -> clika_runtime._core.nn.InitSpec

normal(mean, std) -> InitSpec

Every floating-point slot drawn from N(mean, std^2); a slot of another dtype takes zeros.

## `ones`

```python
onesones() -> clika_runtime._core.nn.InitSpec
```

ones() -> clika_runtime._core.nn.InitSpec

ones() -> InitSpec

Every slot one.

## `zeros`

```python
zeroszeros() -> clika_runtime._core.nn.InitSpec
```

zeros() -> clika_runtime._core.nn.InitSpec

zeros() -> InitSpec

Every slot zero.
