本文共 1586 字,大约阅读时间需要 5 分钟。
concat????????????????????????????????
tf.stack????????????????????????????
unstack?????????????????????????????????????
split????????????????????????????
?????????????????
??????????????????
????????????????
??????????????????????
??????????
sort??????????argsort???????????
?????k???????????
pad???????????????????????????
?????????????????
???????????????
??????????????
????????????
?????????????????
????????????????
??????????????
?????????????????
import tensorflow as tfimport matplotlib.pyplot as pltdef fun(x): z = tf.math.sin(x[...,0]) + tf.math.sin(x[...,1]) return zx = tf.linspace(0., 2*3.14, 500)y = tf.linspace(0., 2*3.14, 500)point_x, point_y = tf.meshgrid(x, y)points = tf.stack([point_x, point_y], axis=2)print(points.shape)z = fun(points)plt.figure('plot 2d func value')plt.imshow(z, origin='lower', interpolation='none')plt.colorbar()plt.figure('plot 2d func contour')plt.contour(point_x, point_y, z)plt.colorbar()plt.show() ??????????????????????????????????
转载地址:http://uzsv.baihongyu.com/