Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG Report]: Variable Sample throws NullReferenceException #1005

Closed
greuelpirat opened this issue Mar 11, 2023 · 1 comment
Closed

[BUG Report]: Variable Sample throws NullReferenceException #1005

greuelpirat opened this issue Mar 11, 2023 · 1 comment

Comments

@greuelpirat
Copy link

Description

I tried the variable example on https://tensorflownet.readthedocs.io/en/latest/Variable.html

But it throws the following exception:

2023-03-11 16:10:46.326691: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructio
ns in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Tensorflow._FetchMapper.for_fetch(Object fetch, Graph graph)
   at Tensorflow._FetchHandler..ctor(Graph graph, Object fetches, Dictionary`2 feeds, Action feed_handles)
   at Tensorflow.BaseSession._run(Object fetches, FeedItem[] feed_dict)
   at Tensorflow.BaseSession.run(Operation op, FeedItem[] feed_dict)
   at Program.<Main>$(String[] args) in ....

Reproduction Steps

var x = tf.Variable(10, name: "x");
using (var session = tf.Session())
{
    session.run(x.initializer);
    var result = session.run(x);
    Console.Write(result); // should be 10
}

Known Workarounds

No response

Configuration and Other Information

csproj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="TensorFlow.NET" Version="0.100.4" />
      <PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.11.0" />
      <PackageReference Include="SciSharp.TensorFlow.Redist-Windows-GPU" Version="2.10.0" />
    </ItemGroup>

</Project>
@Oceania2018
Copy link
Member

Please reference the test here. The doc you mentioned is out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants