recurrent-neural-network

How to create a custom layer in Keras with 'stateful' variables/tensors?

别说谁变了你拦得住时间么 提交于 2020-08-25 04:41:46
问题 I would like to ask you some help for creating my custom layer. What I am trying to do is actually quite simple: generating an output layer with 'stateful' variables, i.e. tensors whose value is updated at each batch. In order to make everything more clear, here is a snippet of what I would like to do: def call(self, inputs) c = self.constant m = self.extra_constant update = inputs*m + c X_new = self.X_old + update outputs = X_new self.X_old = X_new return outputs The idea here is quite

Is there cudnnLSTM or cudNNGRU alternative in tensorflow 2.0

这一生的挚爱 提交于 2020-08-24 10:46:52
问题 The CuDNNGRU in TensorFlow 1.0 is really fast. But when I shifted to TensorFlow 2.0 i am unable to find CuDNNGRU . Simple GRU is really slow in TensorFlow 2.0 . Is there any way to use CuDNNGRU in TensorFlow 2.0 ? 回答1: The importable implementations have been deprecated - instead, LSTM and GRU will default to CuDNNLSTM and CuDNNGRU if all conditions are met: activation = 'tanh' recurrent_activation = 'sigmoid' recurrent_dropout = 0 unroll = False use_bias = True Inputs, if masked , are

Is there cudnnLSTM or cudNNGRU alternative in tensorflow 2.0

此生再无相见时 提交于 2020-08-24 10:46:09
问题 The CuDNNGRU in TensorFlow 1.0 is really fast. But when I shifted to TensorFlow 2.0 i am unable to find CuDNNGRU . Simple GRU is really slow in TensorFlow 2.0 . Is there any way to use CuDNNGRU in TensorFlow 2.0 ? 回答1: The importable implementations have been deprecated - instead, LSTM and GRU will default to CuDNNLSTM and CuDNNGRU if all conditions are met: activation = 'tanh' recurrent_activation = 'sigmoid' recurrent_dropout = 0 unroll = False use_bias = True Inputs, if masked , are

Torchtext AttributeError: 'Example' object has no attribute 'text_content'

Deadly 提交于 2020-08-23 05:04:03
问题 I'm working with RNN and using Pytorch & Torchtext. I've got a problem with building vocab in my RNN. My code is as follows: TEXT = Field(tokenize=tokenizer, lower=True) LABEL = LabelField(dtype=torch.float) trainds = TabularDataset( path='drive/{}'.format(TRAIN_PATH), format='tsv', fields=[ ('label_start', LABEL), ('label_end', None), ('title', None), ('symbol', None), ('text_content', TEXT), ]) testds = TabularDataset( path='drive/{}'.format(TEST_PATH), format='tsv', fields=[ ('text_content

Torchtext AttributeError: 'Example' object has no attribute 'text_content'

不羁岁月 提交于 2020-08-23 05:02:16
问题 I'm working with RNN and using Pytorch & Torchtext. I've got a problem with building vocab in my RNN. My code is as follows: TEXT = Field(tokenize=tokenizer, lower=True) LABEL = LabelField(dtype=torch.float) trainds = TabularDataset( path='drive/{}'.format(TRAIN_PATH), format='tsv', fields=[ ('label_start', LABEL), ('label_end', None), ('title', None), ('symbol', None), ('text_content', TEXT), ]) testds = TabularDataset( path='drive/{}'.format(TEST_PATH), format='tsv', fields=[ ('text_content