看啥推荐读物
专栏名称: TensorFlow
Google官方账号,分享人工智能和TensorFlow相关的最新消息、技术资源、活动和实践案例。联系我们:tfchina@google.com
今天看啥  ›  专栏  ›  TensorFlow

TensorFlow 不仅用于机器学习,还能模拟偏微分方程

TensorFlow  · 公众号  · AI  · 2018-12-04 14:00
TensorFlow 不仅仅可以用于机器学习。在此教程中,我们所举的例子(较为寻常)是使用 TensorFlow 模拟偏微分方程的行为(https://en.wikipedia.org/wiki/Partial_differential_equation)。我们将模拟几个雨滴落在方形池塘水面的情形。基本设置需要导入一些库。#Import libraries for simulationimport tensorflow as tfimport numpy as np#Imports for visualizationimport PIL.Imagefrom io import BytesIOfrom IPython.display import clear_output, Image, display将池塘水面的状态显示为图像的函数。def DisplayArray(a, fmt='jpeg', rng=[0,1]):  """Display an array as a picture."""  a = (a - rng[0])/float(rng[1] - rng[0])*255  a = np.uint8(np.clip(a, 0, 255))  f = BytesIO()  PIL.Image.fromarray(a).save(f, fmt)  clear_output(wait = True)  display(Image(data=f.getvalue()))接下来,我们发起一个互动式 Tensor ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照