tensorflow
记录自己的tensorflow学习过程
fVector
研究NLP,在医疗AI领域,对NLP有兴趣的朋友可以一起聊聊
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
使用tensorflow建立模型
#第一种方式 import tensorflow as tf import tensorflow.keras as keras import tensorflow.keras.layers as layers inputs = keras.Input(shape =(784,)) dense1 = layers.Dense(64,activation = 'relu') x = dense1(inputs) dense2 = layers.Dense(64,activation = 'relu') x原创 2021-10-19 17:32:19 · 611 阅读 · 0 评论 -
tensorflow遇到的问题
为什么dense1后面可以接()然后把参数输入进去? import tensorflow as tf import tensorflow.keras as keras import tensorflow.keras.layers as layers inputs = keras.Input(shape =(784,)) dense1 = layers.Dense(64,activation = 'relu') x = dense1(inputs) #为什么dense1后面可以接()然后把参数输入进去 d原创 2021-10-19 16:55:03 · 119 阅读 · 0 评论 -
automatic differentiation自动微分
higher-order derivatives 高阶导数 import tensorflow as tf ''' 使用tf.GradientTape()记录梯度,含有两个参数,默认persistent = False, watch_accessed_variables = True, persistent = False的话那么梯度就只能计算一次,因为计算一次后梯度就会被释放掉,如果像计算多次,那么一定要使persistent为True。 watch_accessed_varibles = True的原创 2021-10-19 11:36:58 · 2206 阅读 · 0 评论 -
tensor
import tensorflow as tf tensor = tf.constant(0) #产生常数 tf.rank(tensor) #0,常数的秩为0 #直接打印tensor print(tensor) #tf.Tensor(0, shape=(), dtype=int32), 会出现值,shape和dtype #tensor 转换为numpy,只需要tensor后加 '.numpy()'即可 tensor.numpy() x = tf.constant([[1,1],原创 2021-10-19 10:01:18 · 182 阅读 · 0 评论
分享