Skip to content

Commit

Permalink
Dim dim value precomputed more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Oct 9, 2023
1 parent 22a54cd commit 2a5946d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions returnn/tensor/_dim_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,8 @@ def _bin_op_tf(a, b):
raise ValueError("unknown op kind %r" % op.kind)

def _bin_op(a, b):
if b is None:
return None
if a is None:
if isinstance(b, int):
if not template_only and backend and not tf:
Expand All @@ -1110,13 +1112,11 @@ def _bin_op(a, b):
return b.copy(name=y_name)
else:
raise TypeError(f"complete_dyn_size: _bin_op: unexpected type {type(b)}")
if b is None:
return None
assert isinstance(a, _t.Tensor)
if template_only or not backend:
if isinstance(b, _t.Tensor):
return _t.Tensor.get_common_data([a, b], allow_broadcast_all_sources=True)
return a
return a.copy_template()
if tf:
if isinstance(b, _t.Tensor):
res = _t.Tensor.get_common_data([a, b], allow_broadcast_all_sources=True)
Expand Down

0 comments on commit 2a5946d

Please sign in to comment.