Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 利用不动点定理用神经网络求解常微分方程_Python_Tensorflow_Neural Network_Ode - Fatal编程技术网

Python 利用不动点定理用神经网络求解常微分方程

Python 利用不动点定理用神经网络求解常微分方程,python,tensorflow,neural-network,ode,Python,Tensorflow,Neural Network,Ode,我想解决这个问题 使用神经网络,并将其与真实解$u(x)=x$进行比较 方法 构建一个神经网络,比如$v(x;w)$,其中$x$是一维输入,$w$是权重 将损失函数设置为 使用adam或sgd将损失降至最低 问题 理论上,这将通过不动点定理收敛到真解。 但是我不知道如何实现它,特别是如何用张量流梯度设置损失函数 代码 下面是一些我一直坚持的代码 #creat training data x_train = np.arange(10)/10. #the derivatives will

我想解决这个问题

使用神经网络,并将其与真实解$u(x)=x$进行比较

方法

  • 构建一个神经网络,比如$v(x;w)$,其中$x$是一维输入,$w$是权重
  • 将损失函数设置为

  • 使用adam或sgd将损失降至最低
问题

理论上,这将通过不动点定理收敛到真解。 但是我不知道如何实现它,特别是如何用张量流梯度设置损失函数

代码

下面是一些我一直坚持的代码

#creat training data
x_train = np.arange(10)/10. #the derivatives will be taken at these pts.
y_train = np.zeros(x_train.shape) #we do not need it indeed.
# model for the candidate function
model = tf.keras.models.Sequential([
  tf.keras.layers.Dense(10, input_shape=(1,), use_bias=True),
  tf.keras.layers.Dense(1)
])

任何意见都将不胜感激。

您尝试过什么?你读过文档、任何指南或教程吗?我搜索过,但没有找到任何文档