MOE.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:Efficient-Dynamic-Batching 作者: jsuarez5341 项目源码 文件源码
def forward(self, x, fast=False, unitTest=False):
      start = time.time()

      #Run gate
      gates, expertInds = self.gate(x)

      #Run experts
      if unitTest:
         vanilla, _ = self.vanillaExperts(x, gates, expertInds)
         fast, _    = self.fastExperts(x, gates, expertInds)
         return t.abs(vanilla - fast)
      elif fast:
         ret, cellTime = self.fastExperts(x, gates, expertInds)
      else:
         ret, cellTime = self.vanillaExperts(x, gates, expertInds)

      forwardTime = time.time() - start
      return ret, forwardTime, cellTime
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号