΢ Ͷ ^ ھ

cba联赛最近赛程 :Ptf.reverse_sequence()

cba㶫 www.axwwg.com  •rg2020-01-26 11:00:55   ߣ   ҪuՓ(0)

tf.reverse_sequence()
ڿbidirectional_dynamic_rnn()Դaĕr˴a{ reverse_sequence()@һֻȥ@÷lF

tf.reverse_sequence()

ڿbidirectional_dynamic_rnn()Դaĕr˴a{ reverse_sequence()@һֻȥ@÷lF߀c˼־Ϳܿó@ҪÁDеpLSTMڷҪ̎һҪһRķD̎

ȁһ@Ķx

reverse_sequence(
  input,
  seq_lengths,
  seq_axis=None,
  batch_axis=None,
  name=None,
  seq_dim=None,
  batch_dim=None)

inputݔҪDĿˏseq_lengthsһ

Ԫinputÿһ̎ҪDrDLpLSTM@ֵyһOݔZLԒҪDHϏеԪֵDzͬоͿԿ

seq_axisseq_dimPϵԴa²

seq_axis = deprecation.deprecated_argument_lookup("seq_axis", seq_axis,
                          "seq_dim", seq_dim)

return gen_array_ops.reverse_sequence(..., seq_dim=seq_axis,...)ͬbatch_axisbatch_dimҲͬ̎xρfչٷoĽ˲Sbatch_axisinputMзָҌÿƬ iǰ seq_lengths ԪؾS seq_axis DHׁͨnjڏinputеĵbatch_axisSеÿһӏ@ӏĵseq_axisSMзDDLȞ seq_lengths ЌĔֵ

e batch_axis=0seq_axis=1tϣÿһОλ_̎ÿһеÿһMзD෴ batch_axis=1seq_axis=0tОλÿһеďMеķD?Iȥ˫RNNԴaͿ⮔time_major@һԲͬrtime_dim batch_dim @һMϵȡֵʲôǡ෴

һεĜyԇa

a = tf.constant([[1,2,3], [4,5,6], [7,8,9]])
l = tf.constant([1,2,3],tf.int64) # ÿһηDLȷքe1,2,3.aǣ3,3SlДֵֻ3
x = tf.reverse_sequence(a,seq_lengths=l,seq_axis = 0,batch_axis= 1) # ОλMзDDÿһеԪ
y = tf.reverse_sequence(a,seq_lengths=l,seq_axis = 1,batch_axis= 0) # ОλMзDDÿһеԪ
with tf.Session() as sess:
  print(sess.run(x))
  print(sess.run(y))

# ÿһϵԪطN]аl׃ǏÿһЁеքeDǰ1ǰ2ǰ3Ԫ
[[1 5 9]
 [4 2 6]
 [7 8 3]]
# ÿһϵԪطN]аl׃ǏÿһЁеքeDǰ1ǰ2ǰ3Ԫ
[[1 2 3]
 [5 4 6]
 [9 8 7]]

@ƪPtf.reverse_sequence()СoҵȫϣܽoһҲϣҶ֧_֮

ܸdȤ:

  • ԔPython3еSequence typeʹ

P

  • Ptf.reverse_sequence()

    Ptf.reverse_sequence()

    tf.reverse_sequence() ڿbidirectional_dynamic_rnn()Դaĕr˴a{ reverse_sequence()@һֻȥ@÷lF
    2020-01-26
  • pRNN:bidirectional_dynamic_rnn()ʹԔ

    pRNN:bidirectional_dynamic_rnn()ʹԔ

    pRNNbidirectional_dynamic_rnn()ʹԔ fžʲôҪʹõpRNNxһƪµĕrᵽϢʮֵҪ@ЩϢDzԲ׽
    2020-01-26
  • Ptf.nn.dynamic_rnnֵԔ

    Ptf.nn.dynamic_rnnֵԔ

    ԭ tf.nn.dynamic_rnn( cell, inputs, sequence_length=None, initial_state=None, dtype=None, parallel_iterations=None, swap_memory=Fal
    2020-01-26
  • pythonCWxgboostʹ

    pythonCWxgboostʹ

    1.xȡ ԭxgboostxȡlibsvm import xgboost as xgb data = xgb.DMatrix(libsvmļ) ʹsklearnxȡlibsvm from sklearn.
    2020-01-26
  • \ՄTensorflow ӑBpRNNݔ}

    \ՄTensorflow ӑBpRNNݔ}

    tf.nn.bidirectional_dynamic_rnn() def bidirectional_dynamic_rnn( cell_fw, # ǰRNN cell_bw, # RNN inputs, # ݔ sequence_length=No
    2020-01-26
  • pythonȡվӕϢČFa

    pythonȡվӕϢČFa

    TxֻץȡQϢdַ惦 칤DBUtil.py import pymysql class DBUtils(object): def connDB(self):
    2020-01-26
  • TFRecordʽ惦cxȡ

    TFRecordʽ惦cxȡ

    Tensor FlowٷWվṩNxȡķ 1. AdTensor FlowDжx׃Д,ֱǶDӖ^r
    2020-01-26
  • ʹ tf.nn.dynamic_rnn չ_rgSȷʽ

    ʹ tf.nn.dynamic_rnn չ_rgSȷʽ

    چ΂ RNNCell  ʹɫ call M\r ֻЕrgǰMһ  ʹ x1 ho õh1 ͨ^ x2  h1 õ h2  tf.nn.dynamic_r
    2020-01-26
  • tensorflow ckptģͺpbģͫ@ȡcQ,ckptDpbģ͌

    tensorflow ckptģͺpbģͫ@ȡcQ,ckptDpbģ͌

    ckpt from tensorflow.python import pywrap_tensorflow checkpoint_path = 'model.ckpt-8000' reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_pa
    2020-01-26
  • tensorflowģ^mӖ fineturn

    tensorflowģ^mӖ fineturn

    QtensoflowӖģ^mӖfineturnĆ} Ӗa ΄ x = 3.0, y = 100.0 \㹫ʽ xW+b = y Wb # -*- coding: u
    2020-01-26