This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import time | |
import numpy as np | |
print("This code example demonstrates how to train a simple MLP model for price prediction using PyTorch.") | |
print("The model is trained on a sine wave and tested on a shifted sine wave.") | |
print("The goal is to demonstrate sub-ms latency for price prediction using PyTorch") | |
print("on Mac M1-M4 with Metal Performance Shaders (MPS) enabled.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Execute Python code in code blocks and construct a interactive Python console output. | |
This allows you to write code examples, but then execute them, showing the results. | |
https://github.com/facelessuser/pymdown-extensions/issues/1690 | |
Original Gist: https://gist.github.com/facelessuser/53fa4d93f27c252fda813b5e0ba7325c | |
Matplotlib Gist: https://gist.github.com/WolfByttner/e0b855e4b80b9742647411c51c8dfe55 | |
--- |