Add files via upload

This commit is contained in:
David Rotermund 2023-02-02 19:23:09 +01:00 committed by GitHub
parent 24fbb43f52
commit d51738832c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,14 @@
import torch
import math
from network.CPP.PyMultiApp import MultiApp
from network.PyMultiplicationApproximationCPU import MultiplicationApproximationCPU
from network.PyMultiplicationApproximationGPU import MultiplicationApproximationGPU
global_multiapp_gpu_setting: list[torch.Tensor] = []
global_multiapp_size: list[torch.Tensor] = []
global_multiapp_cpp: list[MultiApp] = []
global_multiapp_cpp: list[
MultiplicationApproximationCPU | MultiplicationApproximationGPU
] = []
class Conv2dApproximation(torch.nn.Module):
@ -77,7 +80,11 @@ class Conv2dApproximation(torch.nn.Module):
global_multiapp_gpu_setting.append(torch.tensor([0]))
global_multiapp_size.append(torch.tensor([0, 0, 0, 0]))
global_multiapp_cpp.append(MultiApp())
if device == torch.device("cpu"):
global_multiapp_cpp.append(MultiplicationApproximationCPU())
else:
global_multiapp_cpp.append(MultiplicationApproximationGPU())
self.multiapp_gpu_setting_position = len(global_multiapp_gpu_setting) - 1
self.multiapp_cpp_position = len(global_multiapp_cpp) - 1