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

Commit

Permalink
Regularize handling of dense features
Browse files Browse the repository at this point in the history
Summary: Regularize handling of dense features

Differential Revision: D23502163

fbshipit-source-id: 64d140ff250c51443245ef025f668d86699637ef
  • Loading branch information
Michael Gschwind authored and facebook-github-bot committed Sep 3, 2020
1 parent a7b84d5 commit 02be8cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pytext/torchscript/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def __init__(
@torch.jit.script_method
def forward(
self,
dense_feat: List[List[float]],
texts: Optional[List[str]] = None,
# multi_texts is of shape [batch_size, num_columns]
multi_texts: Optional[List[List[str]]] = None,
tokens: Optional[List[List[str]]] = None,
languages: Optional[List[str]] = None,
dense_feat: Optional[List[List[float]]] = None,
):
inputs: ScriptBatchInput = ScriptBatchInput(
texts=resolve_texts(texts, multi_texts),
Expand Down Expand Up @@ -107,13 +107,13 @@ def __init__(
@torch.jit.script_method
def forward(
self,
right_dense_feat: List[List[float]],
left_dense_feat: List[List[float]],
texts: Optional[List[str]] = None,
# multi_texts is of shape [batch_size, num_columns]
multi_texts: Optional[List[List[str]]] = None,
tokens: Optional[List[List[str]]] = None,
languages: Optional[List[str]] = None,
right_dense_feat: Optional[List[List[float]]] = None,
left_dense_feat: Optional[List[List[float]]] = None,
):
inputs: ScriptBatchInput = ScriptBatchInput(
texts=resolve_texts(texts, multi_texts),
Expand Down Expand Up @@ -150,7 +150,7 @@ def inference_interface(self, argument_type: str):
# LANGUAGES = 3
# DENSE_FEAT = 4

if (sel.argno != -1):
if self.argno != -1:
raise RuntimeError("Cannot change argument type.")
if argument_type == "texts":
self.argno = TEXTS
Expand Down

0 comments on commit 02be8cb

Please sign in to comment.