tf.square

square(
x,
name=None
)

功能说明:

计算张量对应元素平方

参数列表:

参数名 必选 类型 说明
x 是 张量 是 half, float32, float64, int32, int64, complex64, complex128 其中一种类型
name 否 string 运算名称

示例代码:

import tensorflow as tf
ini_x=[[1,2],[3,4],[5,6]]
x=tf.Variable(ini_x,dtype=tf.int32)
ini_op=tf.global_variables_initializer()
xx_op=tf.square(x)
with tf.Session() as sess:
sess.run(ini_op)
print(sess.run(xx_op)) [[ 1 4]
[ 9 16]
[25 36]]

tf.square的更多相关文章

  1. TF Boys (TensorFlow Boys ) 养成记(一)

    本资料是在Ubuntu14.0.4版本下进行,用来进行图像处理,所以只介绍关于图像处理部分的内容,并且默认TensorFlow已经配置好,如果没有配置好,请参考官方文档配置安装,推荐用pip安装.关于 ...

  2. 机器学习笔记5-Tensorflow高级API之tf.estimator

    前言 本文接着上一篇继续来聊Tensorflow的接口,上一篇中用较低层的接口实现了线性模型,本篇中将用更高级的API--tf.estimator来改写线性模型. 还记得之前的文章<机器学习笔记 ...

  3. 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑

    import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...

  4. TF之BN:BN算法对多层中的每层神经网络加快学习QuadraticFunction_InputData+Histogram+BN的Error_curve

    # 23 Batch Normalization import numpy as np import tensorflow as tf import matplotlib.pyplot as plt ...

  5. TF之RNN:实现利用scope.reuse_variables()告诉TF想重复利用RNN的参数的案例—Jason niu

    import tensorflow as tf # 22 scope (name_scope/variable_scope) from __future__ import print_function ...

  6. TF之RNN:matplotlib动态演示之基于顺序的RNN回归案例实现高效学习逐步逼近余弦曲线—Jason niu

    import tensorflow as tf import numpy as np import matplotlib.pyplot as plt BATCH_START = 0 TIME_STEP ...

  7. TF之RNN:TensorBoard可视化之基于顺序的RNN回归案例实现蓝色正弦虚线预测红色余弦实线—Jason niu

    import tensorflow as tf import numpy as np import matplotlib.pyplot as plt BATCH_START = 0 TIME_STEP ...

  8. TF:TF之Tensorboard实践:将神经网络Tensorboard形式得到events.out.tfevents文件+dos内运行该文件本地服务器输出到网页可视化—Jason niu

    import tensorflow as tf import numpy as np def add_layer(inputs, in_size, out_size, n_layer, activat ...

  9. TF之NN:matplotlib动态演示深度学习之tensorflow将神经网络系统自动学习并优化修正并且将输出结果可视化—Jason niu

    import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_ ...

随机推荐

  1. resume.c

    resume.c //采用CURLOPT_RESUME_FROM_LARGE 实现文件断点续传功能 #include <stdlib.h> #include <stdio.h> ...

  2. 如何禁用Visual Studio 2013的浏览器链接功能

    VS2013新增的Browser Link功能虽然“强大”,但我并不需要. 但默认是开启的,会在页面中自动添加如下的代码,真是烦人! <!-- Visual Studio Browser Lin ...

  3. 测试rp文件

    正文: 测试我的博客,我的资源在github上! 地址:https://github.com/gmqllf/tx-lcn

  4. Redis 的安装与使用(单节点)

    Redis 的安装与使用(单节点)   环境:CentOS 6.5 Redis 版本:redis-3.0 (考虑到Redis3.0 在集群和性能提升方面的特性,rc 版为正式版的候选版,而且 很快就出 ...

  5. Linux Crontab内环境变量与Shell环境变量的关系及解决问题的办法

    为了定时监控Linux系统CPU.内存.负载的使用情况,写了个Shell脚本,当达到一定值得时候,发送邮件通知.需要用到Crontab的定时任务去执行这个脚本,但是发现通过命令(./test.sh)执 ...

  6. php file_get_contents读取大容量文件方法

      当我们遇到文本文件体积很大时,比如超过几十M甚至几百M几G的大文件,用记事本或者其它编辑器打开往往不能成功,因为他们都需要把文件内容全部放到内存里面,这时就会发生内存溢出而打开错误,遇到这种情况我 ...

  7. Ubuntu 添加安装字体

    Ubuntu的美化当然少不了漂亮字体的支持,我有时会code一下,所以喜欢adobe的 source code pro(开源),安装步骤如下: (注:如果想导入的字体是一个单ttf文件的,可以直接双击 ...

  8. [转]如何在 Git 里撤销(几乎)任何操作

    任何版本控制系统的一个最有的用特性就是“撤销 (undo)”你的错误操作的能力.在 Git 里,“撤销” 蕴含了不少略有差别的功能. 当你进行一次新的提交的时候,Git 会保存你代码库在那个特定时间点 ...

  9. Ubuntu下设置开机后自动运行命令(转)

    从道理上来讲,Ubuntu开机应该是能够设置执行一些脚本的,事实上确实如此,网上给出了很多解决的方案,基本上是分为两种, 第一种是编辑/etc/下的rc.local脚本, 然后把对应的需要执行的脚本写 ...

  10. django 用户管理系列:1 user

    :first-child{margin-top:0!important}.markdown-body>:last-child{margin-bottom:0!important}.markdow ...