You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

export.py 629 B

123456789101112131415161718192021222324252627282930
  1. # Copyright 2020 Tencent
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. import pnnx
  4. import torch
  5. import torch.nn as nn
  6. import torch.nn.functional as F
  7. class Model(nn.Module):
  8. def __init__(self):
  9. super(Model, self).__init__()
  10. def forward(self, x, y, z, w):
  11. x = F.relu(x)
  12. y = F.relu(y)
  13. z = F.relu(z)
  14. w = F.relu(w)
  15. return x, y, z, w
  16. if __name__ == "__main__":
  17. net = Model()
  18. torch.manual_seed(0)
  19. x = torch.rand(1, 16)
  20. y = torch.rand(12, 2, 16)
  21. z = torch.rand(1, 3, 12, 16)
  22. w = torch.rand(1, 5, 7, 9, 11)
  23. pnnx.export(net, "test_F_relu", (x, y, z, w))