summaryrefslogtreecommitdiff
path: root/neurobench_testing/custom_memristor_model.py
diff options
context:
space:
mode:
Diffstat (limited to 'neurobench_testing/custom_memristor_model.py')
-rw-r--r--neurobench_testing/custom_memristor_model.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/neurobench_testing/custom_memristor_model.py b/neurobench_testing/custom_memristor_model.py
index 8bdcde0..eb91b99 100644
--- a/neurobench_testing/custom_memristor_model.py
+++ b/neurobench_testing/custom_memristor_model.py
@@ -1,5 +1,7 @@
import torch
+import memtorch
from memtorch.bh.memristor.Memristor import Memristor
+from memtorch.utils import clip, convert_range #idk if ill need this
class MemtorchMemristor(Memristor):
def __init__(
@@ -27,16 +29,8 @@ class MemtorchMemristor(Memristor):
self.i_off = i_off
self.p = p
- # makes sure w starts in valid state
- if not hasattr(self, 'w'):
- self.w = torch.tensor(0.5)
-
-
- """
- Updates w and computes new resistance
-
- """
- def step(self, v, dt):
- i = v / self.r_curr
-
+ #state variables
+ self.w = 0.5
+ self.g = 1/self.r_on
+ def window()