Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __API Changes__:

__Bug Fixes__:

- `torch.normal` will now correctly return a leaf tensor.

# NuGet Version 0.102.4

Expand Down
3 changes: 2 additions & 1 deletion src/TorchSharp/Tensor/Factories/Tensor.Factories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public static Tensor eye(long rows, long columns = -1L, ScalarType? dtype = null
/// <returns></returns>
public static Tensor normal(double mean, double std, ReadOnlySpan<long> size, ScalarType? dtype = null, Device? device = null, bool requires_grad = false, Generator? generator = null, string[]? names = null)
{
return randn(size, dtype: dtype, device: device, requires_grad: requires_grad, generator: generator) * std + mean;
return randn(size, dtype, device, requires_grad: false, generator, names)
.mul_(std).add_(mean).requires_grad_(requires_grad);
}

/// <summary>
Expand Down