Skip to content

Conversation

@karandwivedi42
Copy link
Contributor

@karandwivedi42 karandwivedi42 commented May 10, 2018

Fixes #7454

test/test_nn.py Outdated
self.assertEqual(input_tensor, input_tensor.clone().fill_(1))

def test_zeros(self):
for as_variable in [True, False]:

This comment was marked as off-topic.

test/test_nn.py Outdated
input_tensor = self._create_random_nd_tensor(dims, size_min=1, size_max=5, as_variable=as_variable)
init_fn_(input_tensor)
if as_variable:
input_tensor = input_tensor.data

This comment was marked as off-topic.

@soumith soumith merged commit dc0faab into pytorch:master May 11, 2018
@soumith
Copy link
Contributor

soumith commented May 11, 2018

thanks @karandwivedi42 !

weiyangfb pushed a commit to weiyangfb/pytorch that referenced this pull request Jun 11, 2018
* Add zeros_ and ones_ init + tests

* Dedup tests

* Remove all occurences of as_variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] add nn.init.zeros_ and nn.init.ones_

4 participants