11"""Formulation of the inverse Poisson problem in a square domain."""
22
3- import os
3+ import requests
44import torch
5+ from io import BytesIO
56from ... import Condition
7+ from ... import LabelTensor
68from ...operator import laplacian
79from ...domain import CartesianDomain
810from ...equation import Equation , FixedValue
@@ -27,21 +29,27 @@ def laplace_equation(input_, output_, params_):
2729 return delta_u - force_term
2830
2931
30- # Absolute path to the data directory
31- data_dir = os .path .abspath (
32- os .path .join (
33- os .path .dirname (__file__ ), "../../../tutorials/tutorial7/data/"
34- )
32+ # URL of the file
33+ url = "https://github.com/mathLab/PINA/raw/refs/heads/master/tutorials/tutorial7/data/pts_0.5_0.5"
34+ # Download the file
35+ response = requests .get (url )
36+ response .raise_for_status ()
37+ file_like_object = BytesIO (response .content )
38+ # Set the data
39+ input_data = LabelTensor (
40+ torch .load (file_like_object , weights_only = False ).tensor .detach (),
41+ ["x" , "y" , "mu1" , "mu2" ],
3542)
3643
37- # Load input data
38- input_data = torch .load (
39- f = os .path .join (data_dir , "pts_0.5_0.5" ), weights_only = False
40- ).extract (["x" , "y" ])
41-
42- # Load output data
43- output_data = torch .load (
44- f = os .path .join (data_dir , "pinn_solution_0.5_0.5" ), weights_only = False
44+ # URL of the file
45+ url = "https://github.com/mathLab/PINA/raw/refs/heads/master/tutorials/tutorial7/data/pinn_solution_0.5_0.5"
46+ # Download the file
47+ response = requests .get (url )
48+ response .raise_for_status ()
49+ file_like_object = BytesIO (response .content )
50+ # Set the data
51+ output_data = LabelTensor (
52+ torch .load (file_like_object , weights_only = False ).tensor .detach (), ["u" ]
4553)
4654
4755
0 commit comments