# -*- coding: utf-8 -*- import tensorflow as tf # 创建张量 t = tf.constant([1, 2, 3, 4], tf.float32) # 创建会话 session = tf.Session() # 张量转化为ndarray array = session.run(t) # 打印其数据类型与其值 print(type(array)) print(array) <class 'numpy.ndarray'> [ 1. 2. 3. 4.]
# -*- coding: utf-8 -*- import tensorflow as tf # 创建张量 t = tf.constant([1, 2, 3, 4], tf.float32) # 创建会话 session = tf.Session() # 张量转化为ndarray array = session.run(t) # 打印其数据类型与其值 print(type(array)) print(array) <class 'numpy.ndarray'> [ 1. 2. 3. 4.]
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。