<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          tf_geometricTensorFlow 圖神經(jīng)網(wǎng)絡(luò)框架

          聯(lián)合創(chuàng)作 · 2023-09-26 05:22

          tf_geometric是一個(gè)高效且友好的圖神經(jīng)網(wǎng)絡(luò)庫(kù),同時(shí)支持TensorFlow 1.x 和 2.x。

          受到rusty1s/pytorch_geometric項(xiàng)目的啟發(fā),我們?yōu)門ensorFlow構(gòu)建了一個(gè)圖神經(jīng)網(wǎng)絡(luò)(GNN)庫(kù)。 tf_geometric 同時(shí)提供面向?qū)ο蠼涌冢∣OP API)和函數(shù)式接口(Functional API),你可以用它們來構(gòu)建有趣的模型。

          高效且友好的API


          tf_geometric使用消息傳遞機(jī)制來實(shí)現(xiàn)圖神經(jīng)網(wǎng)絡(luò):相比于基于稠密矩陣的實(shí)現(xiàn),它具有更高的效率;相比于基于稀疏矩陣的實(shí)現(xiàn),它具有更友好的API。 除此之外,tf_geometric還為復(fù)雜的圖神經(jīng)網(wǎng)絡(luò)操作提供了簡(jiǎn)易優(yōu)雅的API。 下面的示例展現(xiàn)了使用tf_geometric構(gòu)建一個(gè)圖結(jié)構(gòu)的數(shù)據(jù),并使用多頭圖注意力網(wǎng)絡(luò)(Multi-head GAT)對(duì)圖數(shù)據(jù)進(jìn)行處理的流程:

          # coding=utf-8
          import numpy as np
          import tf_geometric as tfg
          import tensorflow as tf
          
          graph = tfg.Graph(
              x=np.random.randn(5, 20),  # 5個(gè)節(jié)點(diǎn), 20維特征
              edge_index=[[0, 0, 1, 3],
                          [1, 2, 2, 1]]  # 4個(gè)無向邊
          )
          
          print("Graph Desc: \n", graph)
          
          graph.convert_edge_to_directed()  # 預(yù)處理邊數(shù)據(jù),將無向邊表示轉(zhuǎn)換為有向邊表示
          print("Processed Graph Desc: \n", graph)
          print("Processed Edge Index:\n", graph.edge_index)
          
          # 多頭圖注意力網(wǎng)絡(luò)(Multi-head GAT)
          gat_layer = tfg.layers.GAT(units=4, num_heads=4, activation=tf.nn.relu)
          output = gat_layer([graph.x, graph.edge_index])
          print("Output of GAT: \n", output)
          

          輸出:

          Graph Desc:
           Graph Shape: x => (5, 20)  edge_index => (2, 4)    y => None
          
          Processed Graph Desc:
           Graph Shape: x => (5, 20)  edge_index => (2, 8)    y => None
          
          Processed Edge Index:
           [[0 0 1 1 1 2 2 3]
           [1 2 0 2 3 0 1 1]]
          
          Output of GAT:
           tf.Tensor(
          [[0.22443159 0.         0.58263206 0.32468423]
           [0.29810357 0.         0.19403605 0.35630274]
           [0.18071976 0.         0.58263206 0.32468423]
           [0.36123228 0.         0.88897204 0.450244  ]
           [0.         0.         0.8013462  0.        ]], shape=(5, 4), dtype=float32)
          

          入門教程


          使用示例進(jìn)行快速入門

          強(qiáng)烈建議您通過下面的示例代碼來快速入門tf_geometric:

          引用

          如果您在科研出版物中使用了tf_geometric,歡迎引用下方的論文:

          @misc{hu2021efficient,
                title={Efficient Graph Deep Learning in TensorFlow with tf_geometric},
                author={Jun Hu and Shengsheng Qian and Quan Fang and Youze Wang and Quan Zhao and Huaiwen Zhang and Changsheng Xu},
                year={2021},
                eprint={2101.11552},
                archivePrefix={arXiv},
                primaryClass={cs.LG}
          }
          
          瀏覽 36
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色一级片A | 午夜成人在线 | 蝌蚪自拍网站 | 亚洲AV无码A片在线观看蜜桃 | 中文字幕免费视频在线观看 |