---
title: DoublePrecision
description: Plugin for training with double (torch.float64) precision.
canonical: >-
  https://lightning.ai/docs/pytorch/stable/optional-api/api/lightning.pytorch.plugins.precision.DoublePrecision
---
# DoublePrecision {#doubleprecision}

### `class lightning.pytorch.plugins.precision.DoublePrecision` {#lightning.pytorch.plugins.precision.DoublePrecision}

Bases: [`Precision`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.plugins.precision.Precision.md#lightning.pytorch.plugins.precision.Precision "lightning.pytorch.plugins.precision.precision.Precision")

Plugin for training with double (`torch.float64`) precision.

#### `convert_input(data)` {#lightning.pytorch.plugins.precision.DoublePrecision.convert_input}

Convert model inputs (forward) to the floating point precision type of this plugin.

This is a no-op in the base precision plugin, since we assume the data already has the desired type (default is torch.float32).

Return type:

[`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")

#### `convert_module(module)` {#lightning.pytorch.plugins.precision.DoublePrecision.convert_module}

Convert the module parameters to the precision type this plugin handles.

This is optional and depends on the precision limitations during optimization.

Return type:

[`Module`](https://docs.pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module "(in PyTorch v2.15)")

#### `forward_context()` {#lightning.pytorch.plugins.precision.DoublePrecision.forward_context}

A context manager to change the default tensor type.

See: [`torch.set_default_dtype()`](https://docs.pytorch.org/docs/stable/generated/torch.set_default_dtype.html#torch.set_default_dtype "(in PyTorch v2.15)")

Return type:

[`Generator`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Generator "(in Python v3.15)")\[[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)"), [`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)"), [`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")\]

#### `module_init_context()` {#lightning.pytorch.plugins.precision.DoublePrecision.module_init_context}

Instantiate module parameters or tensors in the precision type this plugin handles.

This is optional and depends on the precision limitations during optimization.

Return type:

[`AbstractContextManager`](https://docs.python.org/3/library/contextlib.html#contextlib.AbstractContextManager "(in Python v3.15)")

#### `tensor_init_context()` {#lightning.pytorch.plugins.precision.DoublePrecision.tensor_init_context}

Controls how tensors get created (device, dtype).

Return type:

[`AbstractContextManager`](https://docs.python.org/3/library/contextlib.html#contextlib.AbstractContextManager "(in Python v3.15)")

---

**Navigation**

- Parent: [Api](/docs/pytorch/2.6.6/optional-api/api.md)
