<p dir="auto">Example use case: I allocate a buffer, and put multiple things using <code class="notranslate">out=</code> into the buffer (with views). Naturally I don't want any one of them to resize storage. But currently it's hard to make sure.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/colesbury/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/colesbury">@colesbury</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ezyang/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ezyang">@ezyang</a></p>
<p dir="auto">I want to implement linear regression in Pytorch with sparse connections. To build such a network I cannot use nn.Linear because it is a densely connected layer. I have first tried to make a binary matrix with 0 and 1 to indicate the presence and absence of connections. But it won't work in my case because it is not computationally efficient. I am looking for a sparse weight matrix or sparse linear layer type solutions. I would be really grateful if someone would help me in this regard. I have attached a screenshot also to explain what I'm trying to do.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/58566628/93038137-9dea7080-f65d-11ea-8672-0861457df928.png"><img src="https://user-images.githubusercontent.com/58566628/93038137-9dea7080-f65d-11ea-8672-0861457df928.png" alt="image" style="max-width: 100%;"></a></p>