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.

Unable to use Tensors in Jupyter notebook due to loading errors

See original GitHub issue

Describe the bug

I’m currently trying to use the Jupyter kernel with ML.NET and the OnnxRuntime to prototype model inference based on pre-computed onnx models. However I am unable to use System.Numerics.Tensors to create inputs to the model:

(EDIT - updated to minimal repro)

#r "nuget:Microsoft.ML.OnnxRuntime,1.1.0"

using System.Numerics.Tensors;
var inputValues = new[]{12f, 10f, 17f, 5f};
var tInput = new DenseTensor<float>(inputValues.AsMemory(), new ReadOnlySpan<int>(new[]{4}));

errors with:

Unhandled Exception
Could not load file or assembly 'System.Numerics.Tensors, Version=0.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (0x80131058)
   at Submission#23.<<Initialize>>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Submission#23.<Initialize>()
   at Submission#23.<Factory>(Object[] submissionArray)
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)

This apperently tries to load a reference assembly into the runtime. /cc @eerhardt

Did this error occur while using dotnet try or online?

  • dotnet-try
  • .NET Jupyter Notebook
  • online

What kind of error was it?

  • User Interface (UI): For example the output never displayed
  • Service Error: For example “The service is temporarily unavailable. We are working on it”
  • Other:

Screenshots

Please complete the following:

  • OS
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge (Dev Channel)
    • Safari

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
KevinRansomcommented, Jan 22, 2020

@dasMulli , hey mate, I’m using this issue to track the code-change. So I would like to keep this open for now, if that is good with you 😃

1reaction
jonsequiturcommented, Jan 13, 2020

There’ll be a more general announcement soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to use Tensors in Jupyter notebook due to loading ...
I'm currently trying to use the Jupyter kernel with ML.NET and the OnnxRuntime to prototype model inference based on pre-computed onnx models.
Read more >
Trying to import Tensor flow in my jupyter notebook but ...
Create a New Virtual Environment in Anaconda and Try installing the Latest Version of Tensorflow . Steps are mentioned below:
Read more >
How to Fix Pytorch Module Errors in Jupyter Notebook
1. ModuleNotFoundError. The ModuleNotFoundError is a common error that occurs when Pytorch is unable to locate a module that is required for the ......
Read more >
Using TensorBoard in Notebooks
Start by installing TF 2.0 and loading the TensorBoard notebook extension: For Jupyter users: If you've installed Jupyter and TensorBoard ...
Read more >
What to do when you get an error
Feel free to test it out :) and the first thing you think of is to load the model using the pipeline from...
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