qfnn.qf_fb.c_qf_mixer module

class qfnn.qf_fb.c_qf_mixer.Net(img_size, layers, training, binary, given_ang=[], train_ang=False, debug='False')

Bases: torch.nn.modules.module.Module

class Net is to simply build up a network consisting of quantum layers ,using mat to represent the quantum gate.

Parameters
  • img_size – the width /height of input image (width = height)

  • layers – a 2-dimensions list. for example,[[‘u’,4][‘p’,2]] means that the first layer is u-layer with 4 output qubit, and the second layer is p-layer with 2 output qubit

  • training – whether training

  • binary – whether the input data should be binarized

  • given_ang – initial angle for N-layer if used

forward(x, training=1)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool
qfnn.qf_fb.c_qf_mixer.binarize()
qfnn.qf_fb.c_qf_mixer.clipfunc()