Skip to content

Commit

Permalink
replace config['has_feature'] with config.get('has_feature', False)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasquale Minervini committed Oct 25, 2017
1 parent c8b6665 commit ac29ec2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jack/readers/multiple_choice/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def create_output(self, shared_resources: SharedResources,
support_length: tf.Tensor,
question_length: tf.Tensor) -> Sequence[tf.Tensor]:
input_size = shared_resources.config['repr_dim_input']
if not self.shared_resources.config["vocab_from_embeddings"]:
if not self.shared_resources.config.get("vocab_from_embeddings", False):
if hasattr(self.shared_resources, 'embeddings'):
e = tf.constant(self.shared_resources.embeddings, tf.float32)
else:
Expand Down Expand Up @@ -96,7 +96,7 @@ def training_ports(self) -> List[TensorPort]:
@property
def output_ports(self) -> List[TensorPort]:
"""Defines the outputs of the InputModule"""
if self.shared_resources.config["vocab_from_embeddings"]:
if self.shared_resources.config.get("vocab_from_embeddings", False):
return [Ports.Input.embedded_support,
Ports.Input.embedded_question, Ports.Input.support_length,
Ports.Input.question_length, Ports.Input.sample_id]
Expand Down

0 comments on commit ac29ec2

Please sign in to comment.