-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Models of active components #10
Comments
Following up on this, I recently put some time into a really crude example of voltage controlled phase shifter in SAX: There is still some work to do there to realize easy simulation of circuits with large component counts (1000's of phase shifters), but my next request is that each component has to ability to maintain state. Given that SAX uses functions as it's way of manipulating objects I was wondering if there is any way of a component maintaining state? Thanks for everything you guys do, I really love this software, |
@flaport may have better ideas, but I'll offer a trick I've used in the past for things like this... you can create a callable object in python, by defining a class with the maybe something like this will fit your needs 🙂 |
Hi @tvt173 , this method is indeed the default for PyTorch and is generally speaking a pretty good approach. The problem is that JAX functions are supposed to be pure functions and hence they cannot depend on any hidden state (at least if you want to be able to jit them). Any hidden state that the circuit/network depends on must be given as an argument to the function. This is by the way something that SAX supports as you can specify arbitrary arguments to each model function. However, we could streamline this process a bit better. Maybe the approach that the neural network library flax is taking is pretty good. At first sight they seem to be implementing more or less what you're proposing (a class with a |
nice, sounds promising. i couldn't recall if evaluation of the s-matrices of individual components was in the scope of what was getting jitted or not. if it were brought outside outside the scope, that would give us a bit of extra flexibility, but glad to see there is an option even for the more constrained case |
Hi folks, I know it's been a while, but I've been stuck on this and wanted to reach out for folks advice. I made a fork of sax where I've been trying to add handling of call methods to sax. To see this in action please clone the linked repo and in the examples folder run the "dynamic_sax_component" python notebook. The problem with the code I added can be seen in the second to last code snippet, where you see that whenever we call the MZI circuit the class for the thermal phase shifter is being re-initialized each time, meaning it can not store data/posses memory. I spent a while digging through the sax source code, but have not seen anything I can change which will stop the thermal class being re-initialized. Hoping for your insights, |
Hi Alex, I'll try to take a look today or tomorrow. |
Would it be possible to include models of active components? I want to be able to reference components within the circuit, change an applied voltage and see the effect the phase shift has on the system.
Best,
-Alex
The text was updated successfully, but these errors were encountered: