Tensorflow--tf.Variable与tf.get_variable()
发布日期:2021-05-10 00:15:12 浏览次数:21 分类:精选文章

本文共 1591 字,大约阅读时间需要 5 分钟。

# TensorFlow������������������������tf.Variable()���tf.get_variable()
���TensorFlow���������������������������������������������������������`tf.Variable()`���`tf.get_variable()`������������������������������������������������������������������������
������������������������������������������������������������������������������������������������
1. **tf.Variable()**������������������������������������ kraje���������������������������������������������������
2. **tf.get_variable()**���������������������������������������������������������������������������������������������`tf.get_variable()`���������������������������������������������Variable���`reuse`���������`True`������
������������������������������������������������������������������
```python
import tensorflow as tf
with tf.variable_scope("scope1"):
w1 = tf.get_variable("w1", shape=[])
w2 = tf.Variable(0.0, name="w2")
with tf.variable_scope("scope1", reuse=True):
w1_p = tf.get_variable("w1", shape=[])
w2_p = tf.Variable(1.0, name="w2")
# ������������
# w1 is w1_p: True���������������������������������������
# w2 is w2_p: False������������������������������������������������������

���������

  • ���������������tf.get_variable()������������������������������������������������
  • ���������������tf.Variable()������������������������������������������������������������������������������������������
  • ���������������������������������������������������������TensorFlow���������������������������������������������������������������������������������������������������������������������������������������������

    上一篇:RXJava & Retrofit 结合最佳实践
    下一篇:卷积神经网络CNN知识汇总

    发表评论

    最新留言

    第一次来,支持一个
    [***.219.124.196]2025年04月18日 02时37分21秒