`

randn(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False, pin_memory=False) -> Tensor

Returns a tensor filled with random numbers from a normal distribution
with mean `0` and variance `1` (also called the standard normal
distribution). .. math::
\text{out}_{i} \sim \mathcal{N}(0, 1) The shape of the tensor is defined by the variable argument :attr:`size`. Args:
size (int...): a sequence of integers defining the shape of the output tensor.
Can be a variable number of arguments or a collection like a list or tuple. Keyword args:
generator (:class:`torch.Generator`, optional): a pseudorandom number generator for sampling
out (Tensor, optional): the output tensor.
dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor.
Default: if ``None``, uses a global default (see :func:`torch.set_default_tensor_type`).
layout (:class:`torch.layout`, optional): the desired layout of returned Tensor.
Default: ``torch.strided``.
device (:class:`torch.device`, optional): the desired device of returned tensor.
Default: if ``None``, uses the current device for the default tensor type
(see :func:`torch.set_default_tensor_type`). :attr:`device` will be the CPU
for CPU tensor types and the current CUDA device for CUDA tensor types.
requires_grad (bool, optional): If autograd should record operations on the
returned tensor. Default: ``False``.
pin_memory (bool, optional): If set, returned tensor would be allocated in
the pinned memory. Works only for CPU tensors. Default: ``False``. Example:: >>> torch.randn(4)
tensor([-2.1436, 0.9966, 2.3426, -0.6366])
>>> torch.randn(2, 3)
tensor([[ 1.5954, 2.8929, -1.0923],
[ 1.1719, -0.4709, -0.1996]])

`

torch.randn(*tensor_shape, **kwargs)的更多相关文章

  1. torch.rand、torch.randn、torch.normal、torch.linespace

    torch.rand(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) # ...

  2. PyTorch官方中文文档:torch.nn

    torch.nn Parameters class torch.nn.Parameter() 艾伯特(http://www.aibbt.com/)国内第一家人工智能门户,微信公众号:aibbtcom ...

  3. PyTorch官方中文文档:torch.Tensor

    torch.Tensor torch.Tensor是一种包含单一数据类型元素的多维矩阵. Torch定义了七种CPU tensor类型和八种GPU tensor类型: Data tyoe CPU te ...

  4. 实践torch.fx第二篇-fx量化实操

    好久不见各位,哈哈,又鸽了好久. 本文紧接上一篇<实践torch.fx第一篇--基于Pytorch的模型优化量化神器>继续说,主要讲如何利用FX进行模型量化. 为什么这篇文章拖了这么久,有 ...

  5. PyTorch官方中文文档:torch

    torch 包 torch 包含了多维张量的数据结构以及基于其上的多种数学操作.另外,它也提供了多种工具,其中一些可以更有效地对张量和任意类型进行序列化. 它有CUDA 的对应实现,可以在NVIDIA ...

  6. Pytorch中torch.autograd ---backward函数的使用方法详细解析,具体例子分析

    backward函数 官方定义: torch.autograd.backward(tensors, grad_tensors=None, retain_graph=None, create_graph ...

  7. pytorch中文文档-torch.nn常用函数-待添加-明天继续

    https://pytorch.org/docs/stable/nn.html 1)卷积层 class torch.nn.Conv2d(in_channels, out_channels, kerne ...

  8. torch.nn.functional中softmax的作用及其参数说明

    参考:https://pytorch-cn.readthedocs.io/zh/latest/package_references/functional/#_1 class torch.nn.Soft ...

  9. [转] Torch中实现mini-batch RNN

    工作中需要把一个SGD的LSTM改造成mini-batch的LSTM, 两篇比较有用的博文,转载mark https://zhuanlan.zhihu.com/p/34418001 http://ww ...

  10. (原)torch中的序列化

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6591667.html 参考网址: https://github.com/torch/torch7/bl ...

随机推荐

  1. 记一次 .NET某工控任务调度系统 卡死分析

    一:背景 1. 讲故事 前段时间有位朋友加我微信,来了就要进我的训练营,并且附带着纠结了他几个月的一个疑难杂症,让我帮忙看下怎么回事,问题描述截图如下: 由于这个定时任务是 furion 写的,刚好这 ...

  2. Rust实战系列-Rust介绍

    " 学习资料:rust in action[1] 1. Rust 安装 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | ...

  3. 2docker私有镜像仓库registry

    3 docker私有镜像仓库 3.1准备服务器 重新安装CENTOS7,加大磁盘空间. ip 配置 登录 192.168.168.168 4核虚拟CPU/4G内存/300G磁盘 22/密钥登陆/LCZ ...

  4. 【Linux】Linux内核模块开发

    Linux内核模块开发 零.关于 1.概述 最近在学习Linux相关的东西,学习了U-Boot的编译,Linux的编译,能够在开发板上运行自己编译的U-Boot和Linux了,那么接下来就是在自己编译 ...

  5. 代码随想录第二十二天 | Leecode 77. 组合、216. 组合总和 III、17. 电话号码的字母组合

    Leecode 77. 组合 题目描述 给定两个整数 n 和 k,返回范围 [1, n] 中所有可能的 k个数的组合. 你可以按 任何顺序 返回答案. 示例 1: 输入:n = 4, k = 2 输出 ...

  6. 关于HarmonyOS NEXT中的模块化开发

    今天不写页面和动画,斗胆给大家讲一讲软件工程. 软件工程讲究高内聚低耦合,意思就是把整个工程按照分工不同分成不同的模块,每一个模块紧密联系又互不影响.就像一座摩天大楼,它里面的电路网非常庞大和复杂,它 ...

  7. 物联网之对接MQTT最佳实践

    小伙伴们,你们好呀,我是老寇,跟我一起学习对接MQTT 安装EMQX 采用docker-compose一键式启动!!! 还没有安装docker朋友,参考文章下面两篇文章 # Ubuntu20.04安装 ...

  8. Flex布局-margin 妙用技巧

    在 flex 布局 中, 通过对子项设置 margin-auto; 的方式去吃掉剩余空间, 这种小技巧在很多时候能极大简化我们的布局哦. 单元素水平垂直居中 如果父容器是 flex, 要实现元素水平垂 ...

  9. Web前端入门第 54 问:JavaScript 3 种书写位置及 script 标签的正确存放位置

    JS 的代码并没有强制规定放在 HTML 中的某个位置,如果您有使用过开发者工具查看过网页源码,那么您会看到很多 JS 代码都以 .js 文件的形式存放,并且放在了 HTML 文件最后,也就是 < ...

  10. 2025第一届轩辕杯Misc详解

    Terminal Hacker 一步到位 flag{Cysay_terminal_game_hacked_successfully} 哇哇哇瓦 foremost分离 GekkoYoru 随波逐流检测, ...