python help()函数(查看特定模块、关键词、函数等用法)
示例1:
import torch
help(torch.ones)
运行结果:
D:\Dontla_miniconda3.8\python.exe C:/Users/Administrator/Desktop/d2l/torch_code/code/test3.py
Help on built-in function ones:ones(...)ones(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> TensorReturns a tensor filled with the scalar value `1`, with the shape definedby 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 arguments: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 CPUfor CPU tensor types and the current CUDA device for CUDA tensor types.requires_grad (bool, optional): If autograd should record operations on thereturned tensor. Default: ``False``.Example::>>> torch.ones(2, 3)tensor([[ 1., 1., 1.],[ 1., 1., 1.]])>>> torch.ones(5)tensor([ 1., 1., 1., 1., 1.])进程已结束,退出代码0
示例2:
help(int)
D:\Dontla_miniconda3.8\python.exe C:/Users/Administrator/Desktop/d2l/torch_code/code/test3.py
Help on class int in module builtins:class int(object)| int([x]) -> integer| int(x, base=10) -> integer| | Convert a number or string to an integer, or return 0 if no arguments| are given. If x is a number, return x.__int__(). For floating point| numbers, this truncates towards zero.| | If x is not a number or if base is given, then x must be a string,| bytes, or bytearray instance representing an integer literal in the| given base. The literal can be preceded by '+' or '-' and be surrounded| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.| Base 0 means to interpret the base from the string as an integer literal.| >>> int('0b100', base=0)| 4| | Built-in subclasses:| bool| | Methods defined here:| | __abs__(self, /)| abs(self)| | __add__(self, value, /)| Return self+value.| | __and__(self, value, /)| Return self&value.| | __bool__(self, /)| self != 0| | __ceil__(...)| Ceiling of an Integral returns itself.| | __divmod__(self, value, /)| Return divmod(self, value).| | __eq__(self, value, /)| Return self==value.| | __float__(self, /)| float(self)| | __floor__(...)| Flooring an Integral returns itself.| | __floordiv__(self, value, /)| Return self//value.| | __format__(self, format_spec, /)| Default object formatter.| | __ge__(self, value, /)| Return self>=value.| | __getattribute__(self, name, /)| Return getattr(self, name).| | __getnewargs__(self, /)| | __gt__(self, value, /)| Return self>value.| | __hash__(self, /)| Return hash(self).| | __index__(self, /)| Return self converted to an integer, if self is suitable for use as an index into a list.| | __int__(self, /)| int(self)| | __invert__(self, /)| ~self| | __le__(self, value, /)| Return self<=value.| | __lshift__(self, value, /)| Return self<<value.| | __lt__(self, value, /)| Return self<value.| | __mod__(self, value, /)| Return self%value.| | __mul__(self, value, /)| Return self*value.| | __ne__(self, value, /)| Return self!=value.| | __neg__(self, /)| -self| | __or__(self, value, /)| Return self|value.| | __pos__(self, /)| +self| | __pow__(self, value, mod=None, /)| Return pow(self, value, mod).| | __radd__(self, value, /)| Return value+self.| | __rand__(self, value, /)| Return value&self.| | __rdivmod__(self, value, /)| Return divmod(value, self).| | __repr__(self, /)| Return repr(self).| | __rfloordiv__(self, value, /)| Return value//self.| | __rlshift__(self, value, /)| Return value<<self.| | __rmod__(self, value, /)| Return value%self.| | __rmul__(self, value, /)| Return value*self.| | __ror__(self, value, /)| Return value|self.| | __round__(...)| Rounding an Integral returns itself.| Rounding with an ndigits argument also returns an integer.| | __rpow__(self, value, mod=None, /)| Return pow(value, self, mod).| | __rrshift__(self, value, /)| Return value>>self.| | __rshift__(self, value, /)| Return self>>value.| | __rsub__(self, value, /)| Return value-self.| | __rtruediv__(self, value, /)| Return value/self.| | __rxor__(self, value, /)| Return value^self.| | __sizeof__(self, /)| Returns size in memory, in bytes.| | __sub__(self, value, /)| Return self-value.| | __truediv__(self, value, /)| Return self/value.| | __trunc__(...)| Truncating an Integral returns itself.| | __xor__(self, value, /)| Return self^value.| | as_integer_ratio(self, /)| Return integer ratio.| | Return a pair of integers, whose ratio is exactly equal to the original int| and with a positive denominator.| | >>> (10).as_integer_ratio()| (10, 1)| >>> (-10).as_integer_ratio()| (-10, 1)| >>> (0).as_integer_ratio()| (0, 1)| | bit_length(self, /)| Number of bits necessary to represent self in binary.| | >>> bin(37)| '0b100101'| >>> (37).bit_length()| 6| | conjugate(...)| Returns self, the complex conjugate of any int.| | to_bytes(self, /, length, byteorder, *, signed=False)| Return an array of bytes representing an integer.| | length| Length of bytes object to use. An OverflowError is raised if the| integer is not representable with the given number of bytes.| byteorder| The byte order used to represent the integer. If byteorder is 'big',| the most significant byte is at the beginning of the byte array. If| byteorder is 'little', the most significant byte is at the end of the| byte array. To request the native byte order of the host system, use| `sys.byteorder' as the byte order value.| signed| Determines whether two's complement is used to represent the integer.| If signed is False and a negative integer is given, an OverflowError| is raised.| | ----------------------------------------------------------------------| Class methods defined here:| | from_bytes(bytes, byteorder, *, signed=False) from builtins.type| Return the integer represented by the given array of bytes.| | bytes| Holds the array of bytes to convert. The argument must either| support the buffer protocol or be an iterable object producing bytes.| Bytes and bytearray are examples of built-in objects that support the| buffer protocol.| byteorder| The byte order used to represent the integer. If byteorder is 'big',| the most significant byte is at the beginning of the byte array. If| byteorder is 'little', the most significant byte is at the end of the| byte array. To request the native byte order of the host system, use| `sys.byteorder' as the byte order value.| signed| Indicates whether two's complement is used to represent the integer.| | ----------------------------------------------------------------------| Static methods defined here:| | __new__(*args, **kwargs) from builtins.type| Create and return a new object. See help(type) for accurate signature.| | ----------------------------------------------------------------------| Data descriptors defined here:| | denominator| the denominator of a rational number in lowest terms| | imag| the imaginary part of a complex number| | numerator| the numerator of a rational number in lowest terms| | real| the real part of a complex number进程已结束,退出代码0
python help()函数(查看特定模块、关键词、函数等用法)相关推荐
- pandas创建时间序列仿真数据并过滤(filter)时间数据:头尾数据、某年的数据、某年某月的数据、某年某月某日的数据、某个时间范围内的数据、truncate函数查看特定时间之前护着之后的数据
pandas创建时间序列仿真数据并过滤(filter)时间数据:头尾数据.某年的数据.某年某月的数据.某年某月某日的数据.某个时间范围内的数据.truncate函数查看特定时间之前护着之后的数据 目录
- python 查看某个模块包含函数方法
python 查看某个模块的所有方法:print(dir(模块名)) 查看函数信息(参数.属于哪个模块...):help(函数名)
- python threading join_Python中threading模块join函数用法实例分析
本文实例讲述了Python中threading模块join函数用法.分享给大家供大家参考.具体分析如下: join的作用是众所周知的,阻塞进程直到线程执行完毕.通用的做法是我们启动一批线程,最后joi ...
- python用来查看变量类型的函数是什么_python查看变量类型的函数
怎么查看变量的类型 python方法如下: type(变量),输出的结果就是变量的类型: 在Python里面变量在声明时,不需要指定变量的类型,变量的类型是动态指定的: 也就是说变量的类型,根据给出的 ...
- 小白的Python之路 day5 configparser模块的特点和用法
configparser模块的特点和用法 一.概述 主要用于生成和修改常见配置文件,当前模块的名称在 python 3.x 版本中变更为 configparser.在python2.x版本中为Conf ...
- python中math函数_Python math模块 数学函数教程
在Python基础教程中,大家都已经了解了Python有很多运算符可以进行一些数学运算,但是要处理复杂的问题是不是所有代码都要自己一行一行的来编写呢? 玩蛇网提醒大家,这个时候,最先想到的就应该是py ...
- python os函数_python os模块主要函数
使用python提供的os模块,对文件和目录进行操作,重命名文件,添加,删除,复制目录以及文件等. 一.文件目录常用函数 在进行文件和目录操作时,一般会用到以下几种操作. 1.获得当前:路径 在pyt ...
- python glob函数_python glob 模块 map函数
昨晚有了点小想法,想写个小脚本. 用到了 glob 模块 和 map 函数 觉得他们配合起来和不错的. #coding:utf8 import glob print "glob. ...
- 角谷猜想python代码_查看“Python-2020-fall”的源代码
因为以下原因,您没有权限编辑本页: 您所请求的操作仅限于该用户组的用户使用:用户 您可以查看与复制此页面的源代码.== Python程序设计课程主页(2020年秋季学期) == Teacher: [h ...
最新文章
- GIt版本回退还不会用?轻松学会不怕失误
- maven(android-maven-plugin3.8.0)打包apk无法启动,apklib依赖包的资源索引出错(R文件与主模块冲突)问题解析
- eslint quo_Quo Vadis JUnit
- codeforces 379F-New Year Tree
- 佳能102种相片风格_一位妈妈用蔬菜水果等,为女儿拍了一组相片,没想到在INS火了...
- 二、网络编程中的常用类
- Slickflow.NET 开源工作流引擎高级开发(四) -- 硬核编码:代码式快速构建流程图...
- php serialize参数,php serialize(),unserialize()
- Wl,-rpath的格式问题,Wl,--rpath
- java8 新特性之 -- lamdba 表达式 -- Optional类 --遍历 Map List
- 库克低调访华,3小时郑州行程俨然一位效率大师
- 遍历vad二叉树来遍历进程里的模块
- java.lang.UnsatisfiedLinkError: Couldn't load XXX
- python3D绘图Axes3D函数详解
- ubuntu20.04 + kiosk + chrome打造一体机系统
- 微信小程序的选择收货地址、新增地址、地址管理等模块的总结(1)
- 35岁-45岁的年龄,找不到工作,该如何规划自己的职场下半场?
- 快要圣诞节啦,快去给小伙伴们分享漂亮的圣诞树吧
- 为什么理想电流源的等效内阻是无限大
- C语言1.5e10什么意思,汽车排量1.5e是什么意思