访问量: 9 次浏览
tensorflow.IndexedSlicesSpec()TensorFlow是谷歌设计的开源Python库,用于开发机器学习模型和深度学习神经网络。
IndexedSlicesSpec继承自TypeSpec,为IndexedSlices提供类型规范。
语法:
tensorflow.IndexedSlicesSpec( shape, dtype, indices_dtype, dense_shape_dtype, indices_shape )
参数:
IndexedSlices的密集形状。默认值是None,允许任何密集的形状。IndexedSlices值的dtype。默认值是float32。indices\_dtype(可选):它定义了IndexedSlices中索引的dtype。它可以是int32或int64,默认值为int64。dense\_shape\_dtype(可选):它定义了IndexedSlices中密集形状的dtype。它可以是int32、int64或None,默认值为None。indices\_shape(可选):它定义了索引组件的形状,表明IndexedSlices中有多少个片子。例子1:
这个例子使用所有的默认值。
# Importing the library
import tensorflow as tf
# Calculating result
res = tf.IndexedSlicesSpec()
# Printing the result
print('IndexedSlicesSpec: ', res)
输出:
IndexedSlicesSpec: IndexedSlicesSpec(TensorShape(None), tf.float32, tf.int64, None, TensorShape([None]))
示例 2:
# Importing the library
import tensorflow as tf
# Calculating result
res = tf.IndexedSlicesSpec((2, 3))
# Printing the result
print('IndexedSlicesSpec: ', res)
输出:
IndexedSlicesSpec: IndexedSlicesSpec(TensorShape([2, 3]), tf.float32, tf.int64, None, TensorShape([None]))