tf.squared_difference

squared_difference(
x,
y,
name=None
)

功能说明:

计算张量 x、y 对应元素差平方

参数列表:

参数名 必选 类型 说明
x 张量 是 half, float32, float64, int32, int64, complex64, complex128 其中一种类型
y 张量 是 half, float32, float64, int32, int64, complex64, complex128 其中一种类型
name string 运算名称
s
import tensorflow as tf
import numpy as np initial_x = [[1.,1.],[2.,2.]]
x = tf.Variable(initial_x,dtype=tf.float32)
initial_y=[[1.,2.],[4.,5.]]
y=tf.Variable(initial_y,dtype=tf.float32)
diff = tf.squared_difference(x,y)
init_op = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init_op)
print (sess.run(diff))

[[0. 1.]
[4. 9.]]

tf.squared_difference的更多相关文章

  1. TF常用知识

    命名空间及变量共享 # coding=utf-8 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt; ...

  2. TensorFlow 基础知识

    参考资料: 深度学习笔记目录 向机器智能的TensorFlow实践 TensorFlow机器学习实战指南 Nick的博客 TensorFlow 采用数据流图进行数值计算.节点代表计算图中的数学操作,计 ...

  3. TensorFlow实现线性回归模型代码

    模型构建 1.示例代码linear_regression_model.py #!/usr/bin/python # -*- coding: utf-8 -* import tensorflow as ...

  4. TensorFlow-相关 API(学习笔记 )

    1.tf.nn.conv2d conv2d( input, filter, strides, padding, use_cudnn_on_gpu=True, data_format='NHWC', n ...

  5. Tensorflow数学运算

    一.Tensor 之间的运算规则 1) 相同大小 Tensor 之间的任何算术运算都会将运算应用到元素级 2) 不同大小 Tensor(要求dimension 0 必须相同) 之间的运算叫做广播(br ...

  6. Tensorflow学习笔记2019.01.22

    tensorflow学习笔记2 edit by Strangewx 2019.01.04 4.1 机器学习基础 4.1.1 一般结构: 初始化模型参数:通常随机赋值,简单模型赋值0 训练数据:一般打乱 ...

  7. 【转】【强化学习】Deep Q Network(DQN)算法详解

    原文地址:https://blog.csdn.net/qq_30615903/article/details/80744083 DQN(Deep Q-Learning)是将深度学习deeplearni ...

  8. 【转】强化学习(一)Deep Q-Network

    原文地址:https://www.hhyz.me/2018/08/05/2018-08-05-RL/ 1. 前言 虽然将深度学习和增强学习结合的想法在几年前就有人尝试,但真正成功的开端就是DeepMi ...

  9. 第七节,TensorFlow编程基础案例-TensorBoard以及常用函数、共享变量、图操作(下)

    这一节主要来介绍TesorFlow的可视化工具TensorBoard,以及TensorFlow基础类型定义.函数操作,后面又介绍到了共享变量和图操作. 一 TesnorBoard可视化操作 Tenso ...

随机推荐

  1. 如何搜索IP的地理位置

    如何搜索IP的地理位置 http://www.ip138.com/ 打开上边这个网页以后,会显示自身的IP及地理位置,,,,也可以搜索别人的IP和地理位置,手机号等:截图如下:

  2. saltstack 基础入门文档

    saltstack 和 Puppet Chef 一样可以让你同时在多台服务器上执行命令也包括安装和配置软件.Salt 有两个主要的功能:配置管理和远程执行.这里讲述了saltstack的基本使用方法. ...

  3. C语言学习笔记 (010) - 编写strcpy函数

    很多公司的面试官在面试程序员的时候,要求应聘者写出库函数strcpy()的工作方式或者叫实现,很多人以为这个题目很简单,实则不然,别看这么一个小小的函数,它可以从三个方面来考查: (1)编程风格 (2 ...

  4. You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgrou

    最近有个同事问我,他工程运行时就会有如下提示,但是不影响功能:You've implemented -[<UIApplicationDelegate> application:didRec ...

  5. /struts-tags not found ,/struts-dojo-tags not found 上线后异常解决方案

    上线到2003上后发现2个问题:1 缺少/struts-tags2 缺少/struts-dojo-tags在xp上不用直接指定这些文件的位置,但在其他的系统可能无法自动找到它的路径,一定要明确指定在w ...

  6. Linux C 编程一站式学习

    个人认为这是一个挺不错的从C语言到Linux系统开发的教程,这本是两个网上的文档. 其中 一本是<How To Think Like A Computer Scientist: Learning ...

  7. [转]What are mode and status columns under gp_segment_configuration table

    February 16, 2017 10:39 Goal In this article we will try to understand and answer to the below two q ...

  8. springboot 多环境配置yml或properties

    https://www.cnblogs.com/mr-yang-localhost/p/8971327.html   springboot 多环境配置 https://blog.csdn.net/li ...

  9. SpringApplication初始化

    SpringApplication: private void initialize(Object[] sources) { if (sources != null && source ...

  10. php分享二十六:支付系统设计

    一个典型PHP支付系统的设计与实现 参考:blog.sina.com.cn/s/blog_81f6205801017ec8.html 微信支付开发: http://www.cnblogs.com/tx ...