hyper-connections 0.0.14__py3-none-any.whl → 0.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,7 +121,11 @@ class HyperConnections(Module):
121
121
  self.channel_first = channel_first
122
122
 
123
123
  @classmethod
124
- def get_expand_reduce_stream_functions(cls, num_streams):
124
+ def get_expand_reduce_stream_functions(cls, num_streams, disable = False):
125
+
126
+ if disable:
127
+ return (identity, identity)
128
+
125
129
  expand_fn = partial(repeat, pattern = 'b ... -> (b s) ...', s = num_streams)
126
130
  reduce_fn = partial(reduce, pattern = '(b s) ... -> b ...', reduction = 'sum', s = num_streams)
127
131
 
@@ -133,7 +137,7 @@ class HyperConnections(Module):
133
137
  hyper_conn_klass = cls if not disable else Residual
134
138
 
135
139
  init_hyper_conn_fn = partial(hyper_conn_klass, num_streams)
136
- expand_reduce_fns = cls.get_expand_reduce_stream_functions(num_streams) if not disable else (identity, identity)
140
+ expand_reduce_fns = cls.get_expand_reduce_stream_functions(num_streams, disable = disable)
137
141
 
138
142
  return (init_hyper_conn_fn, *expand_reduce_fns)
139
143
 
@@ -77,6 +77,9 @@ class HyperConnections(Module):
77
77
 
78
78
  @classmethod
79
79
  def get_expand_reduce_stream_functions(cls, num_streams):
80
+ if disable:
81
+ return (identity, identity)
82
+
80
83
  expand_fn = partial(repeat, pattern = 'b ... -> (b s) ...', s = num_streams)
81
84
  reduce_fn = partial(reduce, pattern = '(b s) ... -> b ...', reduction = 'sum', s = num_streams)
82
85
 
@@ -88,7 +91,7 @@ class HyperConnections(Module):
88
91
  hyper_conn_klass = cls if not disable else Residual
89
92
 
90
93
  init_hyper_conn_fn = partial(hyper_conn_klass, num_streams)
91
- expand_reduce_fns = cls.get_expand_reduce_stream_functions(num_streams) if not disable else (identity, identity)
94
+ expand_reduce_fns = cls.get_expand_reduce_stream_functions(num_streams, disable = disable)
92
95
 
93
96
  return (init_hyper_conn_fn, *expand_reduce_fns)
94
97
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper-connections
3
- Version: 0.0.14
3
+ Version: 0.0.15
4
4
  Summary: Hyper-Connections
5
5
  Project-URL: Homepage, https://pypi.org/project/hyper-connections/
6
6
  Project-URL: Repository, https://github.com/lucidrains/hyper-connections
@@ -0,0 +1,7 @@
1
+ hyper_connections/__init__.py,sha256=mAy66IuHqXM4XOyOZGt5mo2B2hfHdUk8jW31YnWNQTg,104
2
+ hyper_connections/hyper_connections.py,sha256=LoyiGGDH81MLUcF9WKT39lA9Y1CXUAd-SYM9tJGQ61A,8099
3
+ hyper_connections/hyper_connections_with_multi_branch_inputs.py,sha256=6KHdqvjUZCyHwf7LVByMMuoQtnEHBxRxdt-4Bw9HPcA,6130
4
+ hyper_connections-0.0.15.dist-info/METADATA,sha256=DnZongXit3VTaT7DxmpK0RRfUhXqfUTjM32a-ofbrIw,5076
5
+ hyper_connections-0.0.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ hyper_connections-0.0.15.dist-info/licenses/LICENSE,sha256=E7RGS7kpJIStk5za_-4DVhWEAamf65EU0CNML25mq4c,1066
7
+ hyper_connections-0.0.15.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- hyper_connections/__init__.py,sha256=mAy66IuHqXM4XOyOZGt5mo2B2hfHdUk8jW31YnWNQTg,104
2
- hyper_connections/hyper_connections.py,sha256=-cqKAGkvSf9NKP-S5cmZU9h59qyPbDq27CSDTmZ5fm8,8042
3
- hyper_connections/hyper_connections_with_multi_branch_inputs.py,sha256=jn-wxAgECVUpiyf1elTtwcr-wvzCQQVS32rxted7XqU,6091
4
- hyper_connections-0.0.14.dist-info/METADATA,sha256=mM6YzyPTNDYZqR-l8cwqxnZfYngaNf0LunycWmIoP4Y,5076
5
- hyper_connections-0.0.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- hyper_connections-0.0.14.dist-info/licenses/LICENSE,sha256=E7RGS7kpJIStk5za_-4DVhWEAamf65EU0CNML25mq4c,1066
7
- hyper_connections-0.0.14.dist-info/RECORD,,