import ptan
import torch.nn as nn


class DQNNet(nn.Module):
    def __init__(self):
        super(DQNNet, self).__init__()
        self.ff = nn.Linear(5, 3)

    def forward(self, x):
        return self.ff(x)


if __name__ == "__main__":
    net = DQNNet()
    print(net)
    tgt_net = ptan.agent.TargetNet(net)
    print("Sieæ podstawowa:", net.ff.weight)
    print("Sieæ docelowa:", tgt_net.target_model.ff.weight)
    net.ff.weight.data += 1.0
    print("Po aktualizacji")
    print("Sieæ podstawowa:", net.ff.weight)
    print("Sieæ docelowa:", tgt_net.target_model.ff.weight)
    tgt_net.sync()
    print("Po synchronizacji")
    print("Sieæ podstawowa:", net.ff.weight)
    print("Sieæ docelowa:", tgt_net.target_model.ff.weight)
