The function of matrix stitching (tf.stack) and matrix decomposition function tf.unstack () example

Source: Internet
Author: User
Import TensorFlow as tf

a = Tf.constant ([1,2,3])
B = tf.constant ([4,5,6])

C = Tf.stack ([a,b],axis=0)
d = Tf.stack ([a,b],axis=1)

e = Tf.unstack (d,axis=0)
f = tf.unstack (D,axis=1) with


TF. Session () as Sess:
    print (' Raw vector data: ') print (
    Sess.run (a)) print (
    Sess.run (b)) print (     
    ' Matrix stitching function example, Get a matrix: ')  #返回值是多维矩阵
    print (' 0-D "stitching ')
    print (Sess.run (c))
    print (' in 1-d ' mode stitching ')
    Print (Sess.run (d))
    
    print (a ' matrix decomposition function example, get a list: ') #返回值是一个list   
    print (' 0-D ")
    print (Sess.run (e))
    Print (' 1 D "decomposition ')
    print (Sess.run (f))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.