-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Can someone help me figure out how to change the MLP structure here to a KAN structure? #93
Comments
Hi, here is a minimal example how you can use KAN to solve PDE, hope this helps! |
Thank you for your assistance. Following your example, I replaced the MLP in PINN with the KAN for solving the PDE process. Below are the modified code and the error messages. I've been working on this for quite some time and am unsure how to resolve it effectively。 加载数据 Helm1data = scipy.io.loadmat('./data/Homo_4Hz_singlesource_ps.mat') U_imag 40401x1 323208 double m 40401x1 323208 double ps = data['Ps'] N = x.shape[0] # 在第二维上连接 x 和 z,形成一个 40401*2 的张量x_i = torch.cat((x_tensor, z_tensor), dim=1)ps_train = ps[idx, :] 定义KAN模型第一种情况:2个输入 2个输出MLP: [2, 40, 40, 40, 40, 40, 40, 40, 40, 2]model = KAN(width=[2, 10, 10, 10, 10, 2], grid=5, k=3, grid_eps=1.0, noise_scale_base=0.25) 实现了一个批量样本的雅可比矩阵的计算。def batch_jacobian(func, x, create_graph=False): 计算梯度def fwd_gradients(Y, x): steps = 25000 loss_values = [] def train():
train() description: 0%| | 0/25000 [00:12<?, ?it/s] |
class PhysicsInformedNN:
The text was updated successfully, but these errors were encountered: