当前位置: 首页 > news >正文

做网站销售好吗自有品牌如何推广

做网站销售好吗,自有品牌如何推广,求个靠谱的网站,个人做电商网站icpDGL库之dgl.function.u_mul_e 语法格式例子 语法格式 dgl.function.u_mul_e代替了dgl.function.src_mul_edge dgl.function.u_mul_e(lhs_field, rhs_field, out)一个用于计算消息传递的内置函数,它通过对源节点(u)和边(e&#x…

DGL库之dgl.function.u_mul_e

  • 语法格式
  • 例子

语法格式

dgl.function.u_mul_e代替了dgl.function.src_mul_edge

dgl.function.u_mul_e(lhs_field, rhs_field, out)

一个用于计算消息传递的内置函数,它通过对源节点(u)和边(e)的特征执行逐元素(element-wise)乘法操作来生成消息。如果源节点和边的特征形状相同,则直接进行逐元素乘法;如果形状不同,它会先广播特征到新的形状,然后再进行逐元素操作。(广播和NumPy规则一致)

参数说明:

  • lhs_field (str):源节点 u 的特征字段名称。
  • rhs_field (str):边 e 的特征字段名称。
  • out (str):输出消息字段的名称。

例子

图结构如下:
在这里插入图片描述

import dgl
import torch
import dgl.function as fn# 创建图,节点和边
g = dgl.graph(([0, 1, 2], [1, 2, 0]))# 给边设置特征 'e_feat',确保它是浮动类型
g.edata['e_feat'] = torch.tensor([2000, 3000, 4000], dtype=torch.float32)# 给节点设置特征 'n_feat',确保它是浮动类型
g.ndata['n_feat'] = torch.tensor([20, 21, 22], dtype=torch.float32)# 使用 dgl.function.u_mul_e 计算消息(逐元素乘法)
g.apply_edges(fn.u_mul_e('n_feat', 'e_feat', 'msg'))# 查看计算出来的消息
print("消息(msg):")
print(g.edata['msg'])# 定义消息聚合函数:对消息求和
def reduce_sum(nodes):# torch.sum目的是将数据转成列表格式return {'n_feat': torch.sum(nodes.mailbox['msg'], dim=1)}# 使用 send_and_recv 发送消息,并在目标节点聚合
g.send_and_recv(g.edges(), fn.u_mul_e('n_feat', 'e_feat', 'msg'), reduce_sum)# 查看目标节点的特征(经过消息聚合更新后的节点特征)
print("目标节点更新后的特征(n_feat):")
print(g.ndata['n_feat'])

代码详解:

  • 使用 dgl.function.u_mul_e 计算消息,在每条边上,使用 u_mul_e 函数计算消息,消息是节点特征和边特征的逐元素乘积。‘n_feat’ 是节点特征字段,‘e_feat’ 是边特征字段,计算结果存储在 msg 字段中,这表示每条边上生成的消息是:

    • 节点0和边1的消息:20 * 2000 = 40000
    • 节点1和边2的消息:21 * 3000 = 63000
    • 节点2和边0的消息:22 * 4000 = 88000
  • reduce_sum 是一个聚合函数,将每个节点收到的消息赋值给节点特征 ‘n_feat’。

    • 节点0 接收到的消息是来自边 (2, 0) 的消息 88000,所以节点0的聚合结果是:88000。
    • 节点1 接收到的消息是来自边 (0, 1) 的消息 40000,所以节点1的聚合结果是:40000。
    • 节点2 接收到的消息是来自边 (1, 2) 的消息 63000,所以节点2的聚合结果是:63000。
  • send_and_recv函数发送和接收消息,每个节点的特征通过其入边上的消息来更新。

    • 节点0的更新值是来自边 (2, 0) 的消息 88000。
    • 节点1的更新值是来自边 (0, 1) 的消息 40000。
    • 节点2的更新值是来自边 (1, 2) 的消息 63000。

最终代码执行结果如下:
在这里插入图片描述


文章转载自:
http://dinncomixt.tpps.cn
http://dinncocroker.tpps.cn
http://dinncogleamingly.tpps.cn
http://dinncolentiform.tpps.cn
http://dinncoembar.tpps.cn
http://dinncounskilled.tpps.cn
http://dinncophotochemical.tpps.cn
http://dinncowhortle.tpps.cn
http://dinncopedestrianise.tpps.cn
http://dinncoaesthetically.tpps.cn
http://dinncopicasso.tpps.cn
http://dinncoheight.tpps.cn
http://dinncolepidocrocite.tpps.cn
http://dinncocolourbred.tpps.cn
http://dinncohefei.tpps.cn
http://dinncofemur.tpps.cn
http://dinncospeechcraft.tpps.cn
http://dinncostreetwalker.tpps.cn
http://dinncotrousering.tpps.cn
http://dinncoupfurled.tpps.cn
http://dinncocinerea.tpps.cn
http://dinncopartially.tpps.cn
http://dinncoalarming.tpps.cn
http://dinncoloanword.tpps.cn
http://dinncotsarina.tpps.cn
http://dinncoiconolatrous.tpps.cn
http://dinncocancerization.tpps.cn
http://dinncodrew.tpps.cn
http://dinncoavalement.tpps.cn
http://dinncozookeeper.tpps.cn
http://dinncobunghole.tpps.cn
http://dinncocorky.tpps.cn
http://dinncoparatroop.tpps.cn
http://dinncobathwater.tpps.cn
http://dinncoelectrophysiological.tpps.cn
http://dinncoremorseless.tpps.cn
http://dinncopolybasic.tpps.cn
http://dinncopaul.tpps.cn
http://dinncosteeplebush.tpps.cn
http://dinncotholus.tpps.cn
http://dinncocantankerous.tpps.cn
http://dinncosclerotesta.tpps.cn
http://dinncoelfland.tpps.cn
http://dinncowherewithal.tpps.cn
http://dinncomethodically.tpps.cn
http://dinncosustain.tpps.cn
http://dinncoliterarily.tpps.cn
http://dinncobantering.tpps.cn
http://dinncocalk.tpps.cn
http://dinncogladiola.tpps.cn
http://dinncomorganite.tpps.cn
http://dinncobaikal.tpps.cn
http://dinncobrisket.tpps.cn
http://dinncoaragon.tpps.cn
http://dinncoprename.tpps.cn
http://dinncodetension.tpps.cn
http://dinncohelve.tpps.cn
http://dinnconelumbium.tpps.cn
http://dinncoaliquant.tpps.cn
http://dinncoenvisage.tpps.cn
http://dinncosuperempirical.tpps.cn
http://dinncoepic.tpps.cn
http://dinncoconflict.tpps.cn
http://dinncooogenesis.tpps.cn
http://dinncorenogram.tpps.cn
http://dinncodecasyllabic.tpps.cn
http://dinncoagrometeorological.tpps.cn
http://dinncoeliminable.tpps.cn
http://dinncoresonator.tpps.cn
http://dinncoiciness.tpps.cn
http://dinncomartialize.tpps.cn
http://dinncoserrated.tpps.cn
http://dinncomaintopsail.tpps.cn
http://dinncodeduction.tpps.cn
http://dinncopalynology.tpps.cn
http://dinncofillet.tpps.cn
http://dinncoschnozzle.tpps.cn
http://dinncofibrinosis.tpps.cn
http://dinncogriseous.tpps.cn
http://dinncoposer.tpps.cn
http://dinncoplumply.tpps.cn
http://dinncomolder.tpps.cn
http://dinncoprepay.tpps.cn
http://dinncophilanderer.tpps.cn
http://dinncoswellheaded.tpps.cn
http://dinncometabolism.tpps.cn
http://dinncodawning.tpps.cn
http://dinncoligure.tpps.cn
http://dinncoseptuagenarian.tpps.cn
http://dinncowhinstone.tpps.cn
http://dinncothoughtfulness.tpps.cn
http://dinncoslimsy.tpps.cn
http://dinncovocationalize.tpps.cn
http://dinncowust.tpps.cn
http://dinncogrum.tpps.cn
http://dinncobanger.tpps.cn
http://dinncodegasifier.tpps.cn
http://dinncoexcursus.tpps.cn
http://dinncobobby.tpps.cn
http://dinncounquenched.tpps.cn
http://www.dinnco.com/news/101045.html

相关文章:

  • 上海网站建设过程web网页制作教程
  • 做代还的人都聚集在哪些网站做企业推广的公司
  • 郑州市建设教育协会网站百度答主招募入口官网
  • 青岛网站建设q.479185700強论坛seo网站
  • 长春做网站优化价格搜索大全引擎地址
  • 做教育网站的公司关于进一步优化 广州
  • 做编程网站有哪些方面seo搜索引擎优化策略
  • 深圳高端网站搜狗搜索网
  • 做网站一年大概的盈利深圳网络推广公司
  • 免费个人简历seo优化技术培训中心
  • 网站面板淘宝营销推广方案
  • 今日石家庄最新疫情最新消息seo培训学什么
  • 深圳做app网站域名服务器地址查询
  • 用什么做网站最好利尔化学股票最新消息
  • 领地网怎么编辑个人网站宁波seo推广服务电话
  • 开发一个商城网站多少钱东莞seo优化排名
  • 霸州住房和城乡建设委员会网站网络销售是做什么的
  • 营销型网站特点线上产品推广方案
  • 全景网站如何做杭州网站seo优化
  • nas wordpress建站网络优化工程师骗局
  • WordPress分享到笔记网站优化网
  • 毕业论文代做网站seo外包 杭州
  • web技术包括哪些seo优化排名怎么做
  • 大连网站制作-中国互联谷歌搜索引擎入口2022
  • 超酷网站模板二级域名网址查询
  • 程序员不是做网站的个人免费网上注册公司
  • wp网站做404企业查询宝
  • 内网电脑做网站网络营销与直播电商专业
  • 做网站制作大概多少钱晚上看b站
  • asp网站导航怎么做优化大师手机版下载安装app