paddle tensorflow_平板屏保图片

paddle tensorflow_平板屏保图片 tf.pad()文档如下,pad(tensor,paddings,mode=’CONSTANT’,name=None,constant_values=0)   Padsatensor.      Thisoperationpadsa`tensor`accordingtothe`paddings`youspecify.   `paddings`is…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

 tf.pad()文档如下,

pad(tensor, paddings, mode=’CONSTANT’, name=None, constant_values=0)
    Pads a tensor.
    
    This operation pads a `tensor` according to the `paddings` you specify.
    `paddings` is an integer tensor with shape `[n, 2]`, where n is the rank of
    `tensor`. For each dimension D of `input`, `paddings[D, 0]` indicates how
    many values to add before the contents of `tensor` in that dimension, and
    `paddings[D, 1]` indicates how many values to add after the contents of
    `tensor` in that dimension. If `mode` is “REFLECT” then both `paddings[D, 0]`
    and `paddings[D, 1]` must be no greater than `tensor.dim_size(D) – 1`. If
    `mode` is “SYMMETRIC” then both `paddings[D, 0]` and `paddings[D, 1]` must be
    no greater than `tensor.dim_size(D)`.
    
    The padded size of each dimension D of the output is:
    
    `paddings[D, 0] + tensor.dim_size(D) + paddings[D, 1]`

 实际使用注意,参数paddings元素数(rank)必须和输入维度一一对应,表示该维度前后填充的层数,文档示例验证如下,

import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)

t = tf.constant([[1, 2, 3], [4, 5, 6]])
paddings = tf.constant([[1, 1,], [2, 2]])
# 'constant_values' is 0.
# rank of 't' is 2.
res = tf.pad(t, paddings, "CONSTANT", constant_values=1)  # [[0, 0, 0, 0, 0, 0, 0],
                                                          #  [0, 0, 1, 2, 3, 0, 0],
                                                          #  [0, 0, 4, 5, 6, 0, 0],
                                                          #  [0, 0, 0, 0, 0, 0, 0]]


print(sess.run(res))

'''
tf.pad(t, paddings, "REFLECT")  # [[6, 5, 4, 5, 6, 5, 4],
                                #  [3, 2, 1, 2, 3, 2, 1],
                                #  [6, 5, 4, 5, 6, 5, 4],
                                #  [3, 2, 1, 2, 3, 2, 1]]

tf.pad(t, paddings, "SYMMETRIC")  # [[2, 1, 1, 2, 3, 3, 2],
                                  #  [2, 1, 1, 2, 3, 3, 2],
                                  #  [5, 4, 4, 5, 6, 6, 5],
                                  #  [5, 4, 4, 5, 6, 6, 5]]
'''

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/170267.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • MATLAB入门教程

    MATLAB入门教程MATLAB入门教程

    2022年8月2日
    5
  • 软件项目工作流程图[通俗易懂]

    软件项目工作流程图

    2022年1月29日
    51
  • oracle 表名拼接_oracle_根据表名拼装语句

    oracle 表名拼接_oracle_根据表名拼装语句1、—–批量删除用户下所有表数据——保留表结构eg:批量删除用户下的所有表数据SELECT’TRUNCATETALBE’||TABLE_NAME||’;’FROMUSER_TABLES;如果表中存在外键会报错,建议使用delete,然后再purgerecyclebin;(清空回收站操作)SELECT’DELETEFROM’||table_name||’…

    2022年5月16日
    41
  • StringUtils工具类常用方法「建议收藏」

    StringUtils工具类常用方法「建议收藏」StringUtils类在操作字符串是安全的,不会报空指针异常,也正因此,在操作字符串时使用StringUtils相比使用原生的String会更加安全。一、判空StringUtils提供常用的判断空字符串有两个方法:isEmpty和isBlank,这两者的有何区别呢,直接看源码://isEmptypublicstaticbooleanisEmpty(Stringstr)…

    2022年6月11日
    31
  • PreparedStatement类详解以及案例

    PreparedStatement类详解以及案例一:jdbc(1)注册驱动(2)获得链接:(3)获得sql容器:Statement:(4)执行sql语句:(5)查询操作,需要遍历结果集:(6)关闭资源:Statement:存在的弊端,可以被sql注入:所以实际开发是不在地用的**PreparedStatement:类:**作用:(1)带有预编译的功能:(2)效率高:(3)防止sql注入:传统…

    2022年5月1日
    51
  • 视频直播技术详解之处理[通俗易懂]

    视频直播技术详解之处理[通俗易懂]声明:本文为CSDN原创投稿文章,未经许可,禁止任何形式的转载。作者:七牛云责编:钱曙光,关注架构和算法领域,寻求报道或者投稿请发邮件qianshg@csdn.net,另有「CSDN高级架构师群」,内有诸多知名互联网公司的大牛架构师,欢迎架构师加微信qshuguang2008申请入群,备注姓名+公司+职位。七牛云于6月底发布了一个针对视频直播的实时流网络LiveNet和完…

    2022年7月24日
    10

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号