\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{physics}
\usepackage{yquant}


\begin{document}

\section{Spacer}

\begin{tikzpicture}
	\begin{yquant}[operator/separation=5mm]
		qubit {$\ket{0}$} a;
		qubit {$\ket{1}$} b;

		h a;
		h b;
		box {$U_f$} (a, b);
		h a;
		measure a;
	\end{yquant}
\end{tikzpicture}

\section{Spacer}

\yquantdefinebox{dots}[inner sep=0pt]{$\dots$}
\begin{tikzpicture}
	\begin{yquant}[operator/separation=5mm]
		qubit {$\ket{0}$} a[2];
		nobit ellipsis;
		qubit {$\ket{0}$} z;
		qubit {$\ket{1}$} b;

		h a[0];
		h a[1];
		dots ellipsis;
		h z;
		h b;
		box {$U_f$} (a[0, 1], ellipsis, z, b);
		h a[0];
		h a[1];
		dots ellipsis;
		h z;
		measure a[0];
		measure a[1];
		dots ellipsis;
		measure z;
	\end{yquant}
\end{tikzpicture}

\end{document}
