Skip to content

Commit

Permalink
Added AI Test
Browse files Browse the repository at this point in the history
- Added RNN Test
  • Loading branch information
MitchellShibilski-Unkel committed May 24, 2024
1 parent 6b54934 commit be150cf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Algorthmic_Tests/gobalAlgTest.py
Original file line number Diff line number Diff line change
@@ -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()

Expand All @@ -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 = []
Expand All @@ -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]
13 changes: 13 additions & 0 deletions Algorthmic_Tests/rnnAlgorithm.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ScoringSysCMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit be150cf

Please sign in to comment.