# Encoding classical data to quantum space

I went through the link " https://learn.qiskit.org/course/ch-applications/hybrid-quantum-classical-neural-networks-with-pytorch-and-qiskit" where a hybrid of classical and quantum computation is used. As per my understanding the classical components is encoded using angle encoding for quantum computation. I could not understand that if I want to use some other encoding such as amplitude encoding...how would I go about.I am not sure how to implement angle encoding and amplitude encoding in pytorch. Thanks in Adv.

Given a single-qubit state $$|\psi\rangle$$ and a factor $$|\alpha| \le 1.0$$, we know that we can write the state in the following form because adding up the norm of the probability amplitudes will add up to 1.0: $$$$|\psi\rangle = \sqrt{1 - \alpha^2}\, |0\rangle+ \alpha\,|1\rangle.$$$$
In the following, we show how this can be achieved by a rotation about the y-axis by a specific angle $$\theta$$.
Let us remind ourselves of the $$R_y$$ operator to perform a rotation about the y-axis: $$R_y(\theta) = \begin{bmatrix} \cos{\frac{\theta}{2}} & -\sin{\frac{\theta}{2}} \\[0.7mm] \sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} \end{bmatrix}.$$ Applying $$R_y$$ to state $$|0\rangle$$: $$R_y(\theta)|0\rangle = R_y(\theta) \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\ = \begin{bmatrix} \cos \frac{\theta}{2} \\[0.7mm] \sin \frac{\theta}{2} \end{bmatrix} \\ =\begin{bmatrix} \sqrt{1 - \sin^2 \frac{\theta}{2}} \\[0.7mm] \sin \frac{\theta}{2} \end{bmatrix}.$$ Now we can simply define $$\theta = 2\,\arcsin(\alpha)$$ and use the $$R_y(\theta)$$ gate to get the state $$|\psi\rangle$$ as desired.