Tensorflow
mathematican
学习使我快乐,学习时我快乐
展开
-
检查GPU的可用性
安装完深度学习环境后需要检查GPU是否可用,方法如下TensorFlowimport tensorflow as tfprint(tf.test.is_gpu_available())PyTorchimport torchprint(torch.cuda.is_available())原创 2022-05-16 21:40:17 · 953 阅读 · 0 评论 -
Tensorflow 自定义算子的导数/梯度计算
在TensorFlow中自定义梯度的两种方法: link,以sign函数为例子。在python和 c++ 端对 op 的梯度进行定义:linkTensorflow官方custom grad的例子:link.以tf.math.log(1 + tf.exp(x))为例子。原创 2022-03-01 20:49:53 · 1157 阅读 · 0 评论 -
conda 安装各个版本的TensorFlow
搜索合适的TensorFlow版本conda search tensorflow-gpu安装tensorflow 1.9.0conda install tensorflow-gpu=1.9.0Remark: 该版本要求python=3.6*,3.5*安装TensorFlow 2.4.0conda install tensorflow-gpu=2.4.1卸载tensorflowconda uninstall tensorflow-gpu...原创 2022-03-01 19:34:49 · 1031 阅读 · 0 评论