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. pycharm 配置使用

    1. 如何添加Package File-> Settings -> Project :XXXX -> Project Interpreter 点右边的"+"号,输 ...

  2. js string对象方法

    substr(start,length) substring(start,end) 返回子串,原字符串不改变.

  3. Easy and cheap cluster building on AWS backup

    https://grapeot.me/easy-and-cheap-cluster-building-on-aws.html Thu 17 July 2014 , by Yan Wang | 2 Co ...

  4. 对称加密-java实现

    主要步骤如下: 1.利用SecretKeyFactory.getInstance("加密算法")创建密钥工厂,加密算法如"DES","AES" ...

  5. 201621123001《Java程序设计》第5周学习总结

    1.本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 Answer: 本周重要关键词有接口,Comparator接口,Comparable接口,interface关键字,抽象类等. 1 ...

  6. powerdesigner导出sql时报错 Generation aborted due to errors detected during the verification of the model.

    powerdesigner导出sql时报错 Generation aborted due to errors detected during the verification of the model ...

  7. AssetBundle打包详解

    Unity5.x AssetBundle打包详解 在网上查看了很多资料,想详细搞清楚AssetBundle的原理.以实现符合项目需求的打包工具和加载逻辑 1. AssetBundle是什么? Asse ...

  8. 预期结果 参数化parametrize

    1.pytest.mark.parametrize装饰器可以实现测试用例参数化. 2.实例: import pytest @pytest.mark.parametrize("req,expe ...

  9. L300 3月英语课下

    重音 句中的实词(内容词)要被重读,读得重.长一点.句中的虚词(功能词)要被轻读或弱读,读得轻.短一点口语交流中,当虚词的在句中起到重要的表意作用时,会被重读. 连读 连读:把一个单词的尾音同下一个单 ...

  10. Chrome插件-网页版BusHound

    Chrome插件-网页版BusHound