4 Created on Tue Jun 30 15:44:26 2020 5 Copyright 2020 Peter Rakyta, Ph.D. 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 11 http://www.apache.org/licenses/LICENSE-2.0 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see http://www.gnu.org/licenses/. 22 @author: Peter Rakyta, Ph.D. 31 from squander.nn.qgd_nn_Wrapper
import qgd_nn_Wrapper
54 if qbit_num > 0
and levels >= 0
and samples_num < 2:
55 dim_over_2 =
int(pow(2, qbit_num-1))
57 chanels, nontrivial_adaptive_layers = super(qgd_nn, self).
get_NN_Chanels( qbit_num=qbit_num, levels=levels )
59 elif qbit_num > 0
and levels >= 0
and samples_num > 1:
60 dim_over_2 =
int(pow(2, qbit_num-1))
61 chanels, nontrivial_adaptive_layers = super(qgd_nn, self).
get_NN_Chanels( qbit_num=qbit_num, levels=levels, samples_num=samples_num )
64 print(
"invalid parameters were given")
67 chanels = chanels.reshape( [samples_num, qbit_num, dim_over_2, dim_over_2, 4] )
69 if (
not nontrivial_adaptive_layers
is None ) :
70 nontrivial_adaptive_layers = nontrivial_adaptive_layers.reshape( [samples_num, -1] )
72 return chanels, nontrivial_adaptive_layers
def get_NN_Chanels(self, qbit_num=-1, levels=-1, samples_num=-1)
Wrapper function to retrieve the data chanels for the neural network.
A QGD Python interface class for the decomposition of N-qubit unitaries into U3 and CNOT gates...
def __init__(self)
Constructor of the class.