Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Fix contiguous isse in bilstm export (#1270)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1270

Call contiguous function on the input embedding in case it's not contiguous, which will cause issue in the Caffe2 operator

Reviewed By: shivanipoddariiith

Differential Revision: D20277324

fbshipit-source-id: 1cfe1e595f8a1014b08c7dba33f8e58a7cc73c34
  • Loading branch information
seayoung1112 authored and facebook-github-bot committed Mar 6, 2020
1 parent 4d45176 commit 569d107
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytext/models/representations/bilstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def forward(
)
states = (state, state)
if torch.onnx.is_in_onnx_export():
lstm_in = [embedded_tokens, states[0], states[1]] + [
lstm_in = [embedded_tokens.contiguous(), states[0], states[1]] + [
param.detach() for param in self.lstm._flat_weights
]
rep, new_state_0, new_state_1 = torch.ops._caffe2.InferenceLSTM(
Expand Down

0 comments on commit 569d107

Please sign in to comment.