0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【量子AIが変える医療 #2】はじめに・量子AIの概要とVQCハイブリッドモデル(後編)

0
Posted at

TorchConnectorで量子層をPyTorchに統合

    self.quantum_layer = TorchConnector(self.qnn)

    # 古典的後処理層
    self.classical_post = nn.Sequential(
        nn.Linear(1, 16),
        nn.ReLU(),
        nn.Linear(16, n_classes),
        nn.Softmax(dim=1)
    )

def forward(self, x: torch.Tensor) -> torch.Tensor:
    x = self.classical_pre(x)
    x = self.quantum_layer(x)
    x = self.classical_post(x)
    return x

print("ハイブリッド量子古典モデルの定義完了")

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?