How to use 'torch expand' in Python

Every line of 'torch expand' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
44def expand(self, batch_shape):
45 n = self.dim()
46 log_normalizer = self.log_normalizer.expand(batch_shape)
47 info_vec = self.info_vec.expand(batch_shape + (n,))
48 precision = self.precision.expand(batch_shape + (n, n))
49 return Gaussian(log_normalizer, info_vec, precision)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

385def batch_expand(t, n):
386 return t.expand(n, t.size(1))

Related snippets