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

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()
主站蜘蛛池模板: 浮梁县| 吉林省| 石林| 温泉县| 临清市| 闽侯县| 乐都县| 上虞市| 长武县| 伊金霍洛旗| 宁夏| 老河口市| 邯郸市| 增城市| 永德县| 阿坝| 抚松县| 松阳县| 广昌县| 丰城市| 博乐市| 西乡县| 元江| 林芝县| 白朗县| 两当县| 潼关县| 沈丘县| 泉州市| 依安县| 延安市| 茶陵县| 收藏| 蒙自县| 磐安县| 阜宁县| 镇宁| 宜州市| 海南省| 新河县| 湘潭县|