官术网_书友最值得收藏!

Tensors generated from library functions

TensorFlow provides various functions to generate tensors with pre-populated values. The generated values from these functions can be stored in a constant or variable tensor. Such generated values can also be provided to the tensor constructor at the time of initialization.

As an example, let's generate a 1-D tensor that's been pre-populated with 100 zeros:

a=tf.zeros((100,))
print(tfs.run(a))

Some of the TensorFlow library functions that populate these tensors with different values at the time of their definition are listed as follows:

  • Populating all of the elements of a tensor with similar values: tf.ones_like()tf.ones(), tf.fill()tf.zeros(), andtf.zeros_like() 
  • Populating tensors with sequences: tf.range(),and tf.lin_space()
  • Populating tensors with a probability distribution: tf.random_uniform()tf.random_normal()tf.random_gamma(),and tf.truncated_normal()
主站蜘蛛池模板: 新营市| 来安县| 怀柔区| 嘉祥县| 仙游县| 健康| 大关县| 河南省| 长岭县| 祥云县| 会昌县| 志丹县| 丽江市| 漳平市| 布尔津县| 志丹县| 清流县| 永福县| 栾城县| 宁安市| 高碑店市| 合水县| 庄河市| 夏津县| 新和县| 丹凤县| 长葛市| 兴隆县| 和硕县| 丹阳市| 厦门市| 诸城市| 年辖:市辖区| 遂川县| 遂川县| 抚顺县| 台北县| 辛集市| 雷波县| 富宁县| 白水县|