---
title: Synth (latest version)
description: API reference for samplomatic.synths.Synth in the latest version of samplomatic
source: https://quantum.cloud.ibm.com/docs/en/api/samplomatic/auto/synths-synth
---

# Synth

*class* `samplomatic.synths.Synth`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/synths/synth.py#L28-L74)

Bases: [`Generic`](https://docs.python.org/3/library/typing.html#typing.Generic)\[`QubitT`, `ParameterT`, `InstructionT`]

Base class for synthesizers.

**Attributes Summary**

|                                                                                                                                         |   |
| --------------------------------------------------------------------------------------------------------------------------------------- | - |
| [`compatible_register_types`](#samplomatic.synths.Synth.compatible_register_types "samplomatic.synths.Synth.compatible_register_types") |   |
| [`num_params`](#samplomatic.synths.Synth.num_params "samplomatic.synths.Synth.num_params")                                              |   |
| [`num_qubits`](#samplomatic.synths.Synth.num_qubits "samplomatic.synths.Synth.num_qubits")                                              |   |

**Methods Summary**

|                                                                                                                                                |                                                                                          |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [`generate_template_values`](#samplomatic.synths.Synth.generate_template_values "samplomatic.synths.Synth.generate_template_values")(register) | Generate parameter values for all gates of the register valid for this synth's template. |
| [`make_template`](#samplomatic.synths.Synth.make_template "samplomatic.synths.Synth.make_template")(qubits, params)                            | Return a parametric template that can synthesize gates.                                  |

**Attributes Documentation**

### compatible\_register\_types

Type: [`frozenset`](https://docs.python.org/3/builtins/stdtypes.html#frozenset)\[[`VirtualType`](/docs/api/samplomatic/auto/virtual-registers-virtual-type "samplomatic.virtual_registers.virtual_type.VirtualType")]

Default value: `frozenset({})`

### num\_params

Type: [`int`](https://docs.python.org/3/builtins/functions.html#int)

Default value: `0`

### num\_qubits

Type: [`int`](https://docs.python.org/3/builtins/functions.html#int)

Default value: `1`

**Methods Documentation**

### generate\_template\_values

*abstractmethod* `generate_template_values(register: VirtualRegister) → ndarray`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/synths/synth.py#L61-L74)

Generate parameter values for all gates of the register valid for this synth’s template.

**Parameters**

**register** – The data register containing the virtual gates to generate template parameter values for.

**Returns**

An array of shape `(register.num_subsystems, register.num_samples, num_params)`.

**Raises**

[**SynthError**](/docs/api/samplomatic/auto/exceptions-synth-error "samplomatic.exceptions.SynthError") – If the provided virtual register type is incompatible with this synth.

### make\_template

*abstractmethod* `make_template(qubits: list[QubitT], params: Iterable[ParameterT]) → Iterable[InstructionT]`

[GitHub](https://github.com/Qiskit/samplomatic/tree/main/samplomatic/synths/synth.py#L44-L59)

Return a parametric template that can synthesize gates.

**Parameters**

- **qubits** – The qubits for which to make the template.
- **params** – The ordered parameters to use while making the template.

**Yields**

Instructions that implement the template.

**Raises**

[**SynthError**](/docs/api/samplomatic/auto/exceptions-synth-error "samplomatic.exceptions.SynthError") – When there is a problem synthesizing.
