---
title: SamplerPub (latest version)
description: API reference for qiskit.primitives.SamplerPub in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.primitives.SamplerPub
---

# SamplerPub

*class* `qiskit.primitives.SamplerPub(circuit, parameter_values=None, shots=None, validate=True)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/primitives/containers/sampler_pub.py#L34-L169)

Bases: `ShapedMixin`

Pub (Primitive Unified Bloc) for a Sampler.

Pub is composed of tuple (circuit, parameter\_values, shots).

If shots are provided this number of shots will be run with the sampler, if `shots=None` the number of run shots is determined by the sampler.

Initialize a sampler pub.

**Parameters**

- **circuit** ([*QuantumCircuit*](/docs/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")) – A quantum circuit.
- **parameter\_values** ([*BindingsArray*](/docs/api/qiskit/qiskit.primitives.BindingsArray "qiskit.primitives.BindingsArray") *| None*) – A bindings array.
- **shots** ([*int*](https://docs.python.org/3/library/functions.html#int) *| None*) – A specific number of shots to run with. This value takes precedence over any value owed by or supplied to a sampler.
- **validate** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) – If `True`, the input data is validated during initialization.

## Attributes

### circuit

A quantum circuit.

### ndim

### parameter\_values

A bindings array.

### shape

### shots

A specific number of shots to run with (optional).

This value takes precedence over any value owed by or supplied to a sampler.

### size

## Methods

### coerce

*classmethod* `coerce(pub, shots=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/primitives/containers/sampler_pub.py#L85-L141)

Coerce a `SamplerPubLike` object into a [`SamplerPub`](#qiskit.primitives.SamplerPub "qiskit.primitives.SamplerPub") instance.

**Parameters**

- **pub** (*SamplerPubLike*) – An object to coerce.
- **shots** ([*int*](https://docs.python.org/3/library/functions.html#int) *| None*) – An optional default number of shots to use if not already specified by the pub-like object.

**Returns**

A coerced sampler pub.

**Return type**

[*SamplerPub*](#qiskit.primitives.SamplerPub "qiskit.primitives.containers.sampler_pub.SamplerPub")

### validate

`validate()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/primitives/containers/sampler_pub.py#L143-L169)

Validate the pub.
