tf.sqeeze:

给定张量输入,此操作返回相同类型的张量,并删除所有尺寸为1的尺寸。 如果不想删除所有尺寸1尺寸,可以通过指定squeeze_dims来删除特定尺寸1尺寸。如果不想删除所有大小是1的维度,可以通过squeeze_dims指定。

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]

shape(squeeze(t)) ==> [2, 3]

Or, to remove specific size 1 dimensions

# 't' is a tensor of shape [1, 2, 1, 3, 1, 1]

shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1]

tf.gather_nd(params, indices, name=None) {#gather_nd} 用indices从张量params得到新张量

cast(x, dtype, name=None) 将x的数据格式转化成dtype

tuple中要求不能被改变,且(),list是[]

tf.round函数用于将TensorFlow张量的值四舍五入为最接近的整数

tf.stop_gradient() :阻挡节点BP的梯度

tf.image.crop_and_resize(image, boxes, box_ind, crop_size, method=None, extrapolation_value=None, name=None)     The result is a 4-D tensor [num_boxes, crop_height, crop_width, depth

return super(self.__class__, self).call(inputs, training=False)
https://www.cnblogs.com/wjx1/p/5084980.html

从运行结果上看,普通继承和super继承是一样的。但是其实它们的内部运行机制不一样,这一点在多重继承时体现得很明显。在super机制里可以保证公共父类仅被执行一次,至于执行的顺序,是按照mro进行的(E.__mro__)。

tf.gather类似embedding lookup ,从tensor中返回指定index对应的

isinstance函数可以对参数类型进行判断:

对参数类型做检查,只允许整数和浮点数类型的参数。数据类型检查可以用内置函数isinstance实现:

def my_abs(x):
    if not isinstance(x, (int, float)):
        raise TypeError('bad operand type')
    if x >= 0:
        return x
    else:
        return -x
zip()是Python的一个内建函数,它接受一系列可迭代的对象作为参数,将对象中对应的元素打包成一个个tuple(元组),第0个元组对应于所有参数的第0个元素,第1个元组对应于所有参数的第1个元素,依此类推,然后返回由这些tuples组成的list(列表)。若传入参数的长度不等,则返回list的长度和参数中长度最短的对象相同。
zip([1,2,3,4],[5,6,7,8])会返回[(1, 5), (2, 6), (3, 7), (4, 8)]
tf.round  向上取整
# TF doesn't have an equivalent to np.repeate() so simulate it
# using tf.tile() and tf.reshape.
b1 = tf.reshape(tf.tile(tf.expand_dims(boxes1, 1),
[1, 1, tf.shape(boxes2)[0]]), [-1, 4])
https://blog.csdn.net/jasonzzj/article/details/60811035 -expanddims
https://blog.csdn.net/loseinvain/article/details/78994615 --tile张量扩张

control_dependencies(control_inputs)返回一个控制依赖的上下文管理器,使用with关键字可以让在这个上下文环境中的操作都在control_inputs 执行。

with g.control_dependencies([a, b, c]):

# `d` and `e` will only run after `a`, `b`, and `c` have executed.

  d = ...
e = ...
tf.control_dependencies和tf.identity同时使用:
https://blog.csdn.net/winycg/article/details/78820032 tf.reduce_sum:
https://blog.csdn.net/lxg0807/article/details/74625861 tf.booleen_mask:
https://www.cnblogs.com/lyc-seu/p/7956231.html array([1, 2, 3, 1, 2, 3, 1, 2, 3])
>>idx = np.where(a > 2)
>>idx
(array([2, 5, 8], dtype=int32),) n p.any:
矩阵a和矩阵b中对应元素是否有一个相等,我们需要使用any..
x1, x2 = horizontal_indicies[[0, -1]]
y1, y2 = vertical_indicies[[0, -1]]
# x2 and y2 should not be part of the box. Increment by 1.





mask-code-python的更多相关文章

  1. VS Code Python 全新发布!Jupyter Notebook 原生支持终于来了!

    VS Code Python 全新发布!Jupyter Notebook 原生支持终于来了! 北京时间 2019 年 10 月 9 日,微软发布了全新的 VS Code Python 插件,带来了众多 ...

  2. 官宣!VS Code Python 全新功能在 PyCon China 全球首发!

    北京时间 2019 年 9 月 21 日,PyCon China 2019 在上海举行. 在下午的演讲中,来自微软开发工具事业部的资深研发工程师 在演讲中,我们看到了 Azure Notebook 与 ...

  3. MAC+VS Code+Python+Markdown调试配置

    目录 VS Code官网下载 VS Code插件推荐 VS Code Python环境配置 Markdown配置 VS Code官方文档 VS Code官网下载 VS Code官网下载地址 VS Co ...

  4. VS Code python初体验笔记

    之前一直都是使用Notepad++来编写Python代码,后来想起来之前查资料的时候有个VS Code可以编写一些的脚本语言(js,node.js)甚至是高级编程语言(C#,PHP,JAVA,Pyth ...

  5. [tool] Visual Studio Code python配置

    语言设置 安装中文插件即可成为中文 选择一个Python解释器 Python是一种解释型语言,为了运行Python代码并获取Python IntelliSense,您必须告诉VS Code使用哪个解释 ...

  6. vs code python保存时pylint提示"Unable to import 'flask'"

    在配置vscode python开发环境时,编写如下代码并保存时,会提示Unable to import 'flask' from flask import Flask app = Flask(__n ...

  7. VS code -python 使用笔记本

    1--使用虚拟环境 |----setting->search: python.venv->设置  venv path (你创建的虚拟环境文件夹所在路径,此处我的是 - 目录下) |---- ...

  8. [leetcode]Gray Code @ Python

    原题地址:https://oj.leetcode.com/problems/gray-code/ 题意: The gray code is a binary numeral system where ...

  9. [code] python+selenium实现打开一个网页

    转载自: http://www.cnblogs.com/fnng/archive/2013/05/29/3106515.html http://www.testwo.com/blog/6931 在ec ...

  10. Visual Studio Code python 代码快速自动提示

    1.file --> setting->设置 搜索 python 或者auto_complete setting.json { "explorer.confirmDelete&q ...

随机推荐

  1. ubuntu默认启动方式修改 psensor命令

    Check UUID sudo blkid Then sudo gedit /etc/default/grub & to pull up the boot loader configurati ...

  2. react router @4 和 vue路由 详解(二)react-router @4用法

    完整版:https://www.cnblogs.com/yangyangxxb/p/10066650.html 2.react-router @4用法 a.大概目录      不需要像vue那样麻烦的 ...

  3. 初时Windows程序

    window 操作系统中,处处是窗体 优点:简单 强大 方便 灵活 步骤: 新建项目 项目类型 visual C#项目 模板 window应用程序 用partial 将同一个窗体的代码分开放在两个文件 ...

  4. linux下 gogs的安装和web钩子

    linux系统下 gogs下载安装以及web钩子的使用 (1)下载gogs  官方网址:https://dl.gogs.io/ 选择合适的版本,解压后就可以使用了 启动gogs的命令:  ./gos ...

  5. RabbitMQ arguments参数设置

    有发布端.消费端.消息路由.消息生命周期和身份认证标识等模块参数的设置. 具体请参考地址:http://www.rabbitmq.com/extensions.html

  6. 玩转X-CTR100 l STM32F4 l DSP指令集性能测试

    我造轮子,你造车,创客一起造起来!塔克创新资讯[塔克社区 www.xtark.cn ][塔克博客 www.cnblogs.com/xtark/ ]      本文介绍X-CTR100控制器 DSP库的 ...

  7. jquery元素插入、删除、清空、找父子级元素

    1)jquery元素插入 <!--位置1--> <div id='test'> <!--位置2--> <div>测试</div> <! ...

  8. 初识linux------用户和用户组

    事先说明 本Linux的版本为Ubuntu. 为避免一些初学者由于权限问题特此事先说明,在非root权限下时,所有的代码加sudo:如下 (1)不在root权限 sudo useradd -m 用户名 ...

  9. jetty调优

    jetty服务器使用遇到一下内存溢出的问题: java.lang.OutOfMemoryError: unable to create new native thread   无法创建新的进程 方法: ...

  10. CSS学习笔记之样式规划

    大家都知道规范灵活的代码布局对提升程序员开发和后期维护效率至关重要,因为css同一元素可能被不同偏重度的选择器命中,相同元素不同的选择器表达式的样式冲突导致的显示异常,再加上不规范的代码,经常让前端代 ...