zoukankan      html  css  js  c++  java
  • EffectiveTensorflow:Tensorflow 教程和最佳实践

    Tensorflow和其他数字计算库(如numpy)之间最明显的区别在于Tensorflow中的操作是符号。 这是一个强大的概念,允许Tensorflow进行所有类型的事情(例如自动区分),这些命令式的库(例如numpy)是不可能的。 但它也是以更难掌握为代价的。 我们在这里的尝试揭示了Tensorflow,并为更有效地使用Tensorflow提供了一些指导方针和最佳实践。

    The most striking difference between Tensorflow and other numerical computation libraries such as numpy is that operations in Tensorflow are symbolic. This is a powerful concept that allows Tensorflow to do all sort of things (e.g. automatic differentiation) that are not possible with imperative libraries such as numpy. But it also comes at the cost of making it harder to grasp. Our attempt here is demystify Tensorflow and provide some guidelines and best practices for more effective use of Tensorflow.

    Let's start with a simple example, we want to multiply two random matrices. First we look at an implementation done in numpy:

    import numpy as np
    
    x = np.random.normal(size=[10, 10])
    y = np.random.normal(size=[10, 10])
    z = np.dot(x, y)
    
    print(z)
    

    Now we perform the exact same computation this time in Tensorflow:

    import tensorflow as tf
    
    x = tf.random_normal([10, 10])
    y = tf.random_normal([10, 10])
    z = tf.matmul(x, y)
    
    sess = tf.Session()
    z_val = sess.run(z)
    
    print(z_val)
    

    项目地址:https://github.com/vahidk/EffectiveTensorflow
    更多教程:http://www.tensorflownews.com

  • 相关阅读:
    svn随笔
    关于PHP调用IE的Com组件的一些要求
    Bash总结
    Firefox常用扩展
    proftpd的一些简单配置
    lua积累
    backbone.js源码解析:extend、Backbone.View
    Ubuntu 12.04LTS 安装VMwareWorkstation
    关于安装Ubuntu不将mbr写入grub的经验
    .NET6发布到linux
  • 原文地址:https://www.cnblogs.com/tensorflownews/p/7356416.html
Copyright © 2011-2022 走看看