Skip to content

Commit

Permalink
flow_operations: redundant validity checks removed
Browse files Browse the repository at this point in the history
  • Loading branch information
CSRavasio committed Nov 25, 2021
1 parent 705b014 commit de2aad5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/oflibnumpy/flow_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def switch_flow_ref(flow: nd, input_ref: str) -> nd:
:return: Flow field as a numpy array of shape :math:`(H, W, 2)`
"""

f = Flow(flow, get_valid_ref(input_ref)).switch_ref()
f = Flow(flow, input_ref).switch_ref()
return f.vecs


Expand All @@ -184,9 +184,8 @@ def invert_flow(flow: nd, input_ref: str, output_ref: str = None) -> nd:
:return: Flow field as a numpy array of shape :math:`(H, W, 2)`
"""

i_ref = get_valid_ref(input_ref)
o_ref = i_ref if output_ref is None else get_valid_ref(output_ref)
f = Flow(flow, i_ref).invert(o_ref)
output_ref = input_ref if output_ref is None else output_ref
f = Flow(flow, input_ref).invert(output_ref)
return f.vecs


Expand Down

0 comments on commit de2aad5

Please sign in to comment.