<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 常量 使用具有以下簽名的`tf.constant()`函數創建常量值張量: ```py tf.constant( value, dtype=None, shape=None, name='Const', verify_shape=False ) ``` 讓我們看看本書中 Jupyter 筆記本中提供的示例代碼: ```py c1=tf.constant(5,name='x') c2=tf.constant(6.0,name='y') c3=tf.constant(7.0,tf.float32,name='z') ``` 讓我們詳細研究一下代碼: * 第一行定義一個常數張量`c1`,給它值 5,并將其命名為 x。 * 第二行定義一個常數張量`c2`,存儲值為 6.0,并將其命名為 y。 * 當我們打印這些張量時,我們看到`c1`和`c2`的數據類型由 TensorFlow 自動推導出來。 * 要專門定義數據類型,我們可以使用`dtype`參數或將數據類型作為第二個參數。在前面的代碼示例中,我們將`tf.float32`的數據類型定義為`tf.float32`。 讓我們打印常量`c1`,`c2`和`c3`: ```py print('c1 (x): ',c1) print('c2 (y): ',c2) print('c3 (z): ',c3) ``` 當我們打印這些常量時,我??們得到以下輸出: ```py c1 (x): Tensor("x:0", shape=(), dtype=int32) c2 (y): Tensor("y:0", shape=(), dtype=float32) c3 (z): Tensor("z:0", shape=(), dtype=float32) ``` 為了打印這些常量的值,我們必須使用`tfs.run()`命令在 TensorFlow 會話中執行它們: ```py print('run([c1,c2,c3]) : ',tfs.run([c1,c2,c3])) ``` 我們看到以下輸出: ```py run([c1,c2,c3]) : [5, 6.0, 7.0] ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看