import tensorflow as tf
x=tf.constant([-0.2,0.5,43.98,-23.1,26.58])
y=tf.clip_by_value(x,1e-10,1.0)
sess=tf.Session()
print sess.run(y)

sess.close()

clip_by_value(
    t,
    clip_value_min,
    clip_value_max,
    name=None
)

Given a tensor t, this operation returns a tensor of the same type and shape as t with its values clipped to clip_value_min and clip_value_max. Any values less than clip_value_min are set to clip_value_min. Any values greater than clip_value_max are set to clip_value_max.

Args:

  • t: A Tensor.
  • clip_value_min: A 0-D (scalar) Tensor, or a Tensor with the same shape as t. The minimum value to clip by.
  • clip_value_max: A 0-D (scalar) Tensor, or a Tensor with the same shape as t. The maximum value to clip by.
  • name: A name for the operation (optional).

Returns:

A clipped Tensor.

tf随笔-6的更多相关文章

  1. TF随笔-13

    import tensorflow as tf a=tf.constant(5) b=tf.constant(3) res1=tf.divide(a,b) res2=tf.div(a,b) with ...

  2. TF随笔-11

    #!/usr/bin/env python2 # -*- coding: utf-8 -*- import tensorflow as tf my_var=tf.Variable(0.) step=t ...

  3. TF随笔-10

    #!/usr/bin/env python# -*- coding: utf-8 -*-import tensorflow as tf x = tf.constant(2)y = tf.constan ...

  4. TF随笔-9

    计算累加 #!/usr/bin/env python2 # -*- coding: utf-8 -*-"""Created on Mon Jul 24 08:25:41 ...

  5. TF随笔-8

    #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jul 10 09:35:04 201 ...

  6. TF随笔-7

    求平均值的函数 reduce_mean axis为1表示求行 axis为0表示求列 >>> xxx=tf.constant([[1., 10.],[3.,30.]])>> ...

  7. tf随笔-5

    # -*- coding: utf-8 -*-import tensorflow as tfw1=tf.Variable(tf.random_normal([2,6],stddev=1))w2=tf. ...

  8. TF随笔-4

    >>> import tensorflow as tf>>> a=tf.constant([[1,2],[3,4]])>>> b=tf.const ...

  9. TF随笔-3

    >>> import tensorflow as tf>>> node1 = tf.constant(3.0, dtype=tf.float32)>>& ...

随机推荐

  1. Linux指令od和hexdump

    Linux指令:od (octal dump) 示例用法:od -c hello Linux指令:od od命令用户通常使用od命令查看特殊格式的文件内容.通过指定该命令的不同选项可以以十进制.八进制 ...

  2. HTML 块级元素与行内元素

    1.块元素一般都从新行开始,它可以容纳内联元素和其他块元素,常见块元素是段落标签'P".“form"这个块元素比较特殊,它只能用来容纳其他块元素. 2.如果没有css的作用,块元素 ...

  3. T25健身视频全集+课表

    http://jianfei.39.net/thread-3639251-1.html T25健身视频全集+课表 强度适中 不伤膝盖! [复制链接]     zytttt         主题 好友 ...

  4. javac是啥

    javac是java语言编程编译器.全称java compiler. javac工具读有java语言编写的类和接口的定义,并将它们编译成字节代码的class文件.

  5. angularJS 中的传参

    今天总结一下 angularJS 传参的 3种方式:(配合 ui-router) 现在有两个页面,page1.html 和 page2.html, 现由 page1.html 向 page2.html ...

  6. JavaScript与Java数据类型的区别

    今天开始正式认真学习js,虽然在平常j2ee开发中也经常用到JS但并不精通,这次随笔记下js与Java数据类型的不同之处 Number 与java不同,js作为弱类型语言即使在浮点数与整数上也未作明确 ...

  7. Sybase:SybaseIQ的几个系统过程

    Sybase:SybaseIQ的几个系统过程 sp_iqlocks 显示与数据库中 IQ 存储区和目录存储区中的锁有关的信息. 删除锁:drop connection XXX sp_iqwho 显示所 ...

  8. 20145109 《Java程序设计》第三周学习总结

    20145109 <Java程序设计>第三周学习总结 教材学习内容总结 Chapter 4 Object 4.1 Class & Object definition of clas ...

  9. object c中@property 的使用

    assign:  对基础的数据类型,比如NSInteger和C数据类型(int,float,char)等 copy: 针对NSString retail:   针对NSObject及其子类 nonat ...

  10. 从零开始玩转logback

    概述 LogBack是一个日志框架,它与Log4j可以说是同出一源,都出自Ceki Gülcü之手.(log4j的原型是早前由Ceki Gülcü贡献给Apache基金会的)下载地址:http://l ...