tensorflow 查阅文档

 

 输入代码:

# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 14:04:21 2023

@author: Shawn.Li
"""

import tensorflow as tf

print(dir(dir))

print(dir(tf.random))

help(dir)
help(tf.range)

 输出:

['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']
['Algorithm', 'Generator', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_sys', 'all_candidate_sampler', 'categorical', 'create_rng_state', 'experimental', 'fixed_unigram_candidate_sampler', 'gamma', 'get_global_generator', 'learned_unigram_candidate_sampler', 'log_uniform_candidate_sampler', 'normal', 'poisson', 'set_global_generator', 'set_seed', 'shuffle', 'stateless_binomial', 'stateless_categorical', 'stateless_gamma', 'stateless_normal', 'stateless_parameterized_truncated_normal', 'stateless_poisson', 'stateless_truncated_normal', 'stateless_uniform', 'truncated_normal', 'uniform', 'uniform_candidate_sampler']
Help on built-in function dir in module builtins:

dir(...)
    dir([object]) -> list of strings
    
    If called without an argument, return the names in the current scope.
    Else, return an alphabetized list of names comprising (some of) the attributes
    of the given object, and of attributes reachable from it.
    If the object supplies a method named __dir__, it will be used; otherwise
    the default dir() logic is used and returns:
      for a module object: the module's attributes.
      for a class object:  its attributes, and recursively the attributes
        of its bases.
      for any other object: its attributes, its class's attributes, and
        recursively the attributes of its class's base classes.

Help on function range in module tensorflow.python.ops.math_ops:

range(start, limit=None, delta=1, dtype=None, name='range')
    Creates a sequence of numbers.
    
    Creates a sequence of numbers that begins at `start` and extends by
    increments of `delta` up to but not including `limit`.
    
    The dtype of the resulting tensor is inferred from the inputs unless
    it is provided explicitly.
    
    Like the Python builtin `range`, `start` defaults to 0, so that
    `range(n) = range(0, n)`.
    
    For example:
    
start = 3
limit = 18
delta = 3
tf.range(start, limit, delta)
    <tf.Tensor: shape=(5,), dtype=int32,
    numpy=array([ 3,  6,  9, 12, 15], dtype=int32)>
    
start = 3
limit = 1
delta = -0.5
tf.range(start, limit, delta)
    <tf.Tensor: shape=(4,), dtype=float32,
    numpy=array([3. , 2.5, 2. , 1.5], dtype=float32)>
    
limit = 5
tf.range(limit)
    <tf.Tensor: shape=(5,), dtype=int32,
    numpy=array([0, 1, 2, 3, 4], dtype=int32)>
    
    Args:
      start: A 0-D `Tensor` (scalar). Acts as first entry in the range if `limit`
        is not None; otherwise, acts as range limit and first entry defaults to 0.
      limit: A 0-D `Tensor` (scalar). Upper limit of sequence, exclusive. If None,
        defaults to the value of `start` while the first entry of the range
        defaults to 0.
      delta: A 0-D `Tensor` (scalar). Number that increments `start`. Defaults to
        1.
      dtype: The type of the elements of the resulting tensor.
      name: A name for the operation. Defaults to "range".
    
    Returns:
      An 1-D `Tensor` of type `dtype`.
    
    @compatibility(numpy)
    Equivalent to np.arange
    @end_compatibility

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值