zoukankan      html  css  js  c++  java
  • Matrix Operations

    一 Code example

    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
    import tensorflow as tf 
    import numpy as np 
    A = tf.constant([[1,2,3],[4,5,6]])
    B = tf.fill([3,4],3)
    C = tf.constant([[1,2,3,4],[11,22,33,44]])
    
    with tf.Session() as sess:
        A_value = sess.run(A)
        B_value = sess.run(B)
        print('A_value
    ',A_value)
        print('B_value
    ',B_value)
        print('C_value
    ',sess.run(C))
        print('Matrix multiplication')
        matmal = tf.matmul(A,B)
        print(matmal)
        print('matmal_value
    ',sess.run(matmal))
        print('Matrix addition')
        add = tf.add(matmal,C)
        print(add)
        print('add_value
    ',sess.run(add))
    

    二 Operation result

    正是江南好风景
  • 相关阅读:
    习题2-7
    习题2-6
    习题2-5
    习题2-4
    习题2-3
    作业二 分支循环结构
    2- 8
    实验三-计算圆柱体积
    实验三-计算n个圆柱体体积
    实验3-计算圆面积
  • 原文地址:https://www.cnblogs.com/monsterhy123/p/13069767.html
Copyright © 2011-2022 走看看