# coding:utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division import tensorflow as tf x = tf.placeholder(dtype=tf.float32)
y = tf.placeholder(dtype=tf.float32) z = tf.multiply(x, x) + 3 * tf.multiply(x, y) + tf.multiply(y, y)
dx, dy = tf.gradients(z, [x, y]) init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
dx_value, dy_value = sess.run([dx, dy], feed_dict={x: 1, y: 2})
print("dz/dx={}".format(dx_value))
print("dz/dy={}".format(dy_value))

用tensorflow求偏导的更多相关文章

  1. 矩阵的f范数及其求偏导法则

    转载自: http://blog.csdn.net/txwh0820/article/details/46392293 矩阵的迹求导法则   1. 复杂矩阵问题求导方法:可以从小到大,从scalar到 ...

  2. 矩阵的 Frobenius 范数及其求偏导法则

    cr:http://blog.csdn.net/txwh0820/article/details/46392293 一.矩阵的迹求导法则   1. 复杂矩阵问题求导方法:可以从小到大,从scalar到 ...

  3. Maths | 二次型求偏导

  4. 矩阵的frobenius范数及其求偏导法则

    例子: http://www.mathchina.net/dvbbs/dispbbs.asp?boardid=4&Id=3673

  5. MathType二次偏导怎么表示

    求导以及求偏导运算在数学中是很重要的一个部分,尤其是在高等数学中,基本都由函数的导数与偏导组成,很多公式定理也是关于这方面的,如果少了这一部分,数学将会黯然失色.因此在文档中涉及到这些内容时,必然会少 ...

  6. 用tensorflow求手写数字的识别准确率 (简单版)

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = in ...

  7. 【FJOI2014】【偏导+数学】病毒防护带

    转载:http://trinklee.blog.163.com/blog/static/23815806020150155296528/ 问题描述: 众所周知,在国王胖哥的带领下,K国国泰民安,空前繁 ...

  8. 【机器学习基础】对 softmax 和 cross-entropy 求导

    目录 符号定义 对 softmax 求导 对 cross-entropy 求导 对 softmax 和 cross-entropy 一起求导 References 在论文中看到对 softmax 和 ...

  9. [zt]矩阵求导公式

    今天推导公式,发现居然有对矩阵的求导,狂汗--完全不会.不过还好网上有人总结了.吼吼,赶紧搬过来收藏备份. 基本公式:Y = A * X --> DY/DX = A'Y = X * A --&g ...

随机推荐

  1. ACGallery I: Sequence diagram for reading photos:

    AC Photo Gallery is an open-source web app, which designed to organize photos/albums. Codes on Githu ...

  2. C++中对C的扩展学习新增语法——lambda 表达式(匿名函数)

    1.匿名函数基础语法.调用.保存 1.auto lambda类型 2.函数指针来保存注意点:[]只能为空,不能写东西 3.std::function来保存 2.匿名函数捕捉外部变量(值方式.引用方式) ...

  3. Python文件写入时的编码问题解决

    如下代码: import sys import os import django root_dir = os.path.join(os.path.dirname(os.path.abspath(__f ...

  4. Mybatis 关联对象不能输出的解决办法

    Mybatis 关联对象不能输出的解决办法 1.如图所示,现在进行查询的时候并没有得到来自另一张表address项 2.我们进行如下配置: (1).在mybatis-config.xml 文件中配置, ...

  5. JQury自动切换图片

    [标签]Jquery图片自动切换<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ht ...

  6. spring 工具类大集合

    接以前的文章 apache-commons 常用工具类 和文章 apache-commons 工具类扩展 小家 Spring 对 spring 的工具类做了详细的介绍(一) 这里我抽出一些好用的类,不 ...

  7. nginx支持https配置

    nginx证书 nginx.conf配置.

  8. [译]Nginx入门引导教程

    本文为[Beginner's Guide]译文,原文地址:http://nginx.org/en/docs/beginners_guide.html Guide 本教程基础的介绍了 nginx,以及能 ...

  9. java学生管理系统

    student类 package cn.itheima.Manag; /** * *标准类 * **/public class Student { //学号 private String id; // ...

  10. STM32F103C8T6 在VSCode下使用Platform IO开发,基于库函数V3.5版本

    首先安装Platform IO插件,怎么安装的教程有很多,可以自行百度,就不在重复了. 本篇文章将会以正点原子的跑马灯例程作为移植对象,基于ST固件库3.5版本 将实现在VSCode上的程序编写与烧录 ...