码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • nn.Linear & Tensor.masked_fill


    文章目录

    • 1. nn.Linear
    • 2. Tensor.masked_fill

    1. nn.Linear

    • torch.nn.Linear(in_features, out_features, bias=True, device=None, dtype=None)

      • Applies a linear transformation to the incoming data: y = x A T + b y = xA^T + b y=xAT+b
      • This module supports TensorFloat32.
      • On certain ROCm devices, when using float16 inputs this module will use different precision for backward.
    • Parameters

      • in_features – size of each input sample
      • out_features – size of each output sample
      • bias – If set to False, the layer will not learn an additive bias. Default: True
    • Shape:

      • Input: ( ∗ , H i n ) (*, H_{in}) (∗,Hin​), where * means any number of dimensions including none and H i n = in_features H_{in} = \text{in\_features} Hin​=in_features
      • Output: ( ∗ , H o u t ) (*, H_{out}) (∗,Hout​), where all but the last dimension are the same shape as the input and H o u t = out_features H_{out} = \text{out\_features} Hout​=out_features

    2. Tensor.masked_fill

    Tensor.masked_fill_(mask, value)

    Fills elements of self tensor with value where mask is True. The shape of mask must be broadcastable with the shape of the underlying tensor.

    • Parameters
      • mask (BoolTensor) – the boolean mask
      • value (float) – the value to fill in with
  • 相关阅读:
    升级到tomcat10和Java 21后,idea控制台system.out.println输出中文乱码问题
    【生物信息学】使用谱聚类(Spectral Clustering)算法进行聚类分析
    MySQL 视图简介
    关系型数据库存储多维指标数据
    线性规划在多种问题形式下的应用
    大数据数据挖掘系统可视化设计艺术
    Java程序猿搬砖笔记(九)
    国外LEAD赚钱的一些习惯
    express中间件(简介,流程,分类介绍)
    再学责任链和代理模式
  • 原文地址:https://blog.csdn.net/weixin_47532216/article/details/126138220
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号