question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Default printing of tensors in notebooks causes exception

See original GitHub issue

The default printing of scalar tensors in F# .NET Interactive notebooks causes an exception:

  1. create an F# notebook at https://mybinder.org/v2/gh/dotnet/interactive/master?urlpath=lab

  2. Run this

#i "nuget: https://ci.appveyor.com/nuget/diffsharp"
#r "nuget: DiffSharp-lite,0.9.5-preview-2006281542" // update version as needed, see a recent build in https://ci.appveyor.com/project/dsyme/diffsharp/history

open DiffSharp

dsharp.tensor 3.0

Expected: nice printing of tensor

Actual: exception "Cannot enumerate Tensor with dim "

Oddly also applies to tensors of any dimension.

   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1639.Invoke(String message) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1639
   at DiffSharp.Tensor.System-Collections-Generic-IEnumerable`1-GetEnumerator()
   at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable`1 source, Func`3 selector)+MoveNext()
   at Microsoft.DotNet.Interactive.Formatting.EnumerableExtensions.TakeAndCountRemaining[T](IEnumerable`1 source, Int32 count) in F:\workspace\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\EnumerableExtensions.cs:line 19
   at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter`1.<>c__DisplayClass7_0.<CreateForSequence>g__BuildTable|3(T source, TextWriter writer) in F:\workspace\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 112

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dsymecommented, Aug 26, 2020

thanks!

0reactions
gbaydincommented, Aug 26, 2020

Well, I do just think a lot of .NET stuff may have a problem with an infinite unrolling of IEnumerable. It’s just asking for trouble…

Ok, I’m convinced. We can merge #153 and move on. I think the Tensor -> IEnumerable use case is also available through the .unstack() method that you used in the PR.

I think the formatter for dotnet interactive is a separate issue we can work on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clarifying exceptions and visualizing tensor operations in ...
The following subsections illustrate the anemic default exception messages and my proposed TensorSensor approach, rather than a debugger or print statements ...
Read more >
RuntimeError: Expected all tensors to be on the same ...
else: print("MPS is available. Setting as default device.") mps_device = torch.device("mps") default_device(mps_device).
Read more >
Internal error: Failed to apply delegate: Attempting to use a ...
java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: Attempting to use a delegate that only supports static-sized tensors with a graph ...
Read more >
Default printer choice doesn't stick
Is possible the option 'Let Windows manage my default printer' is enabled and is causing this problem. 1-Click on Start then click on...
Read more >
What to do when you get an error
In this section we'll look at some common errors that can occur when you're trying to generate predictions from your freshly tuned Transformer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found