91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.18MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-18
  • 語言: Python
  • 標簽:

資源簡介

Deep Reinforcement Learning For Sequence to Sequence Models

資源截圖

代碼片段和文件信息

#?Copyright?2016?The?TensorFlow?Authors.?All?Rights?Reserved.
#?Modifications?Copyright?2017?Abigail?See
#
#?Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
#?you?may?not?use?this?file?except?in?compliance?with?the?License.
#?You?may?obtain?a?copy?of?the?License?at
#
#?????http://www.apache.org/licenses/LICENSE-2.0
#
#?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
#?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
#?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
#?See?the?License?for?the?specific?language?governing?permissions?and
#?limitations?under?the?License.
#?==============================================================================

“““This?file?defines?the?decoder“““

import?tensorflow?as?tf
from?tensorflow.python.ops?import?variable_scope
from?tensorflow.python.ops?import?array_ops
from?tensorflow.python.ops?import?nn_ops
from?tensorflow.python.ops?import?gen_array_ops
from?tensorflow.python.ops?import?math_ops
from?tensorflow.python.ops.distributions?import?categorical
from?tensorflow.python.ops.distributions?import?bernoulli
from?rouge_tensor?import?rouge_l_fscore

FLAGS?=?tf.app.flags.FLAGS

def?print_shape(str?var):
??tf.logging.info(‘shape?of?{}:?{}‘.format(str?[k?for?k?in?var.get_shape()]))


def?_calc_final_dist(_hps?v_size?_max_art_oovs?_enc_batch_extend_vocab?p_gen?vocab_dist?attn_dist):
??“““Calculate?the?final?distribution?for?the?pointer-generator?model
??Args:
????vocab_dists:?The?vocabulary?distributions.?List?length?max_dec_steps?of?(batch_size?vsize)?arrays.?The?words?are?in?the?order?they?appear?in?the?vocabulary?file.
????attn_dists:?The?attention?distributions.?List?length?max_dec_steps?of?(batch_size?max_enc_steps)?arrays

??Returns:
????final_dists:?The?final?distributions.?List?length?max_dec_steps?of?(batch_size?extended_vsize)?arrays.
??“““
??with?tf.variable_scope(‘final_distribution‘):
????#?Multiply?vocab?dists?by?p_gen?and?attention?dists?by?(1-p_gen)
????vocab_dist?=?p_gen?*?vocab_dist
????attn_dist?=?(1-p_gen)?*?attn_dist

????#?Concatenate?some?zeros?to?each?vocabulary?dist?to?hold?the?probabilities?for?in-article?OOV?words
????extended_vsize?=?v_size?+?_max_art_oovs?#?the?maximum?(over?the?batch)?size?of?the?extended?vocabulary
????extra_zeros?=?tf.zeros((_hps.batch_size?_max_art_oovs))
????vocab_dists_extended?=?tf.concat(axis=1?values=[vocab_dist?extra_zeros])?#?list?length?max_dec_steps?of?shape?(batch_size?extended_vsize)

????#?Project?the?values?in?the?attention?distributions?onto?the?appropriate?entries?in?the?final?distributions
????#?This?means?that?if?a_i?=?0.1?and?the?ith?encoder?word?is?w?and?w?has?index?500?in?the?vocabulary?then?we?add?0.1?onto?the?500th?entry?of?the?final?distribution
????#?This?is?done?for?each?decoder?timestep.
????#?This?is?fiddly;?we?use?tf.scatter_nd?to?do?the?projection
????batch_nums?=?tf.range(0?limit=_hps.batch_size)?#?shape?(batch_size)
????batch_nums?=?tf.expan

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\
?????文件????????3221??2019-06-18?20:31??RLSeq2Seq-master\CODE_OF_CONDUCT.md
?????文件????????1714??2019-06-18?20:31??RLSeq2Seq-master\CONTRIBUTING.rst
?????文件????????1073??2019-06-18?20:31??RLSeq2Seq-master\LICENSE.txt
?????文件???????30301??2019-06-18?20:31??RLSeq2Seq-master\README.rst
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\docs\
?????文件????????8196??2019-06-18?20:31??RLSeq2Seq-master\docs\.DS_Store
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\docs\_img\
?????文件????????6148??2019-06-18?20:31??RLSeq2Seq-master\docs\_img\.DS_Store
?????文件??????146506??2019-06-18?20:31??RLSeq2Seq-master\docs\_img\rlseq.png
?????文件??????166086??2019-06-18?20:31??RLSeq2Seq-master\docs\_img\selfcritic.png
?????文件???????68612??2019-06-18?20:31??RLSeq2Seq-master\docs\_img\seq2seq.png
?????文件??????????60??2019-06-18?20:31??RLSeq2Seq-master\python_requirements.txt
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\results\
?????文件????????1449??2019-06-18?20:31??RLSeq2Seq-master\results\nointradecoder-notemporal-withpretraining-after-RL.txt
?????文件????????1448??2019-06-18?20:31??RLSeq2Seq-master\results\nointradecoder-notemporal-withpretraining-before-RL.txt
?????文件????????6331??2019-06-18?20:31??RLSeq2Seq-master\results\scripts.txt
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\src\
?????文件????????8196??2019-06-18?20:31??RLSeq2Seq-master\src\.DS_Store
?????文件???????????0??2019-06-18?20:31??RLSeq2Seq-master\src\__init__.py
?????文件???????38545??2019-06-18?20:31??RLSeq2Seq-master\src\attention_decoder.py
?????文件???????18476??2019-06-18?20:31??RLSeq2Seq-master\src\batcher.py
?????文件???????10537??2019-06-18?20:31??RLSeq2Seq-master\src\beam_search.py
?????文件???????12760??2019-06-18?20:31??RLSeq2Seq-master\src\data.py
?????文件???????11926??2019-06-18?20:31??RLSeq2Seq-master\src\decode.py
?????文件????????6493??2019-06-18?20:31??RLSeq2Seq-master\src\dqn.py
?????文件?????????843??2019-06-18?20:31??RLSeq2Seq-master\src\file_spliter.py
?????文件??????681215??2019-06-18?20:31??RLSeq2Seq-master\src\filter_files.txt
?????目錄???????????0??2019-06-18?20:31??RLSeq2Seq-master\src\helper\
?????文件????????3989??2019-06-18?20:31??RLSeq2Seq-master\src\helper\README.rst
?????文件????????3796??2019-06-18?20:31??RLSeq2Seq-master\src\helper\cnn_dm_data_maker.py
............此處省略13個文件信息

評論

共有 條評論