diff --git a/Algorthmic_Tests/gobalAlgTest.py b/Algorthmic_Tests/gobalAlgTest.py index 02f065d..06a2ed5 100644 --- a/Algorthmic_Tests/gobalAlgTest.py +++ b/Algorthmic_Tests/gobalAlgTest.py @@ -1,9 +1,10 @@ from Algorthmic_Tests import primeCounter from Algorthmic_Tests import waveFunction +from Algorthmic_Tests import rnnAlgorithm import time -def algorithmTest(): +def algorithmTest(useGPU: bool = False): startTimer = time.process_time() startTimer2 = time.process_time() @@ -29,6 +30,12 @@ def algorithmTest(): endTimer5 = time.process_time() + startTimer6 = time.process_time() + + rnnAlgorithm.RNN([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10, 10, 10, useGPU) + + endTimer6 = time.process_time() + endTimer = time.process_time() pointList = [] @@ -37,6 +44,7 @@ def algorithmTest(): pointList.append((endTimer3 - startTimer3) // 0.0005 * 0.1) pointList.append((endTimer4 - startTimer4) // 0.0005 * 0.1) pointList.append((endTimer5 - startTimer5) // 0.0005 * 0.1) + pointList.append((endTimer6 - startTimer6) // 0.0005 * 0.1) pointList.append(sum(pointList) + (endTimer - startTimer) // 10) return pointList[-1] \ No newline at end of file diff --git a/Algorthmic_Tests/rnnAlgorithm.py b/Algorthmic_Tests/rnnAlgorithm.py new file mode 100644 index 0000000..5bcc96e --- /dev/null +++ b/Algorthmic_Tests/rnnAlgorithm.py @@ -0,0 +1,13 @@ +from torch import nn +from torch import Tensor + + +def RNN(values: list, inputSize: int, hiddenSize: int, numLayers: int, useGPU: bool = False): + if useGPU == True: + rnn = nn.RNN(inputSize, hiddenSize, numLayers).to("cuda") + else: + rnn = nn.RNN(inputSize, hiddenSize, numLayers).to("cpu") + + final = rnn(Tensor(values)) + + return final \ No newline at end of file diff --git a/ScoringSysCMD.py b/ScoringSysCMD.py index 59ae369..80541f1 100644 --- a/ScoringSysCMD.py +++ b/ScoringSysCMD.py @@ -29,6 +29,6 @@ def terminal(l = [], a = 0, b = 0, l2 = []): l2 = [random.randint(0, 100000000) for _ in range(random.randrange(8, 10000))] def run(): - return terminal(l, a, b, l2)) + return terminal(l, a, b, l2) print(run(l, a, b, l2))