# Assign value to a placeholder

**URL:** <https://community.konduit.ai/t/assign-value-to-a-placeholder/2633>\
**Category:** SameDiff\
**Created:** [June 14, 2023, 1:17pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633 "2023-06-14T13:17:44Z")\
**Posts on this page:** 16\
**Page:** 3

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 23, 2023, 11:21am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/47 "2023-06-23T11:21:47Z")

</div>

Thanks. The file does exist. I checked manually and programmatically.

Here is the output:

```java
 saveFileForInference exists --- 
 saveFileForInference.getAbsolutePath() - /home/adonnini1/Development/ContextQSourceCode/NeuralNetworks/deeplearning4j-examples-master_1/dl4j-examples/src/main/assets/location_next_neural_network_v6_07.fb
 saveFileForInference.length() - 8664

```

and, here is the trace:

```java
Exception in thread "main" java.lang.NullPointerException
	at org.nd4j.linalg.api.ops.impl.layers.recurrent.LSTMLayer.configureWithSameDiff(LSTMLayer.java:210)
	at org.nd4j.autodiff.samediff.SameDiff.fromFlatBuffers(SameDiff.java:6058)
	at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5914)
	at org.nd4j.autodiff.samediff.SameDiff.fromFlatFile(SameDiff.java:5895)
	at org.deeplearning4j.examples.quickstart.modeling.recurrent.LocationNextNeuralNetworkV6_03.sameDiff3(LocationNextNeuralNetworkV6_03.java:402)
	at org.deeplearning4j.examples.quickstart.modeling.recurrent.LocationNextNeuralNetworkV6_03.main(LocationNextNeuralNetworkV6_03.java:155)

```

Do you still think the file is missing? Please keep in mind that I went through the same steps, saving and retrieving saved networks, when implementing with dl4j, and never had any problems or spent so much time resolving what appears to be a straightforward mistake on my part.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [June 23, 2023, 11:30am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/48 "2023-06-23T11:30:48Z")

</div>

@adonnini that actually might be a bug. DM me your file so I can ensure this is fixed with the latest release. I’m 99% sure it is.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 23, 2023, 12:32pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/49 "2023-06-23T12:32:16Z")

</div>

Hi Adam,

The saved network file is attached to this message.

Should I upgrade to the latest release? Currently, I am using 1.0.0-M2.1

On a different subject,

I have not been able to get visualization to work when using samediff.  
SameDiff does not support StatsListener, as far as I can tell. I tried  
using ScoreListener without success. Any pointers, or sample code? With  
dl4j, I was able to activate visualization using the code in your  
documentation.

Thanks,

Alex

(Attachment location\_next\_neural\_network\_v6\_07.fb is missing)

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 23, 2023, 12:45pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/50 "2023-06-23T12:45:10Z")

</div>

Stupid question. How can I send you a file that is not jpg, png or other format allowed for attachments? Sorry

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [June 23, 2023, 12:45pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/51 "2023-06-23T12:45:48Z")

</div>

@adonnini ah sorry thanks for reminding me. No you’d need to build from source to do that. I’ll have it ready soon. I’m finishing up cuda tests now.

Here’s an example:

```auto
 IrisDataSetIterator iter = new IrisDataSetIterator(150, 150);

        SameDiff sd = getSimpleNet();

        File dir = testDir.toFile();
        File f = new File(dir, "logFile.bin");
        UIListener l = UIListener.builder(f)
                .plotLosses(1)
                .trainEvaluationMetrics("softmax", 0, Evaluation.Metric.ACCURACY, Evaluation.Metric.F1)
                .updateRatios(1)
                .build();

        sd.setListeners(l);

        sd.setTrainingConfig(TrainingConfig.builder()
                .dataSetFeatureMapping("in")
                .dataSetLabelMapping("label")
                .updater(new Adam(1e-1))
                .weightDecay(1e-3, true)
                .build());

        sd.fit(iter, 20);

        //Test inference after training with UI Listener still around
        Map<String, INDArray> m = new HashMap<>();
        iter.reset();
        m.put("in", iter.next().getFeatures());
        INDArray out = sd.outputSingle(m, "softmax");

```

Of note, please feel free to poke around in the tests in the deeplearning4j repo if something’s missing from the examples. That will often give you some good answers.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 23, 2023, 8:39pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/52 "2023-06-23T20:39:23Z")

</div>

Thanks. This is helpful.

Using the code in the example you sent me, I was able to produce a UIListener log file in my chosen location.

However, unless I am mistaken, `UIServer.attach` supports only a parameter of `StatsStorage` type

So, I don’t see how I can pass the file produced by UIListener to UIServer.

By the way, it looks like there is no option to keep the `UIListener` file in memory. At least, I could not find one.

Is there a different `UIServer` used with `SameDiff`?

Thanks

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 29, 2023, 11:12am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/53 "2023-06-29T11:12:09Z")

</div>

Hi Adam,

I re-read your answer

> [@agibsonccc](#):
>
> Edit: to answer your other question there doesn’t need to be one. You use the same normalizers. If you’ve used .output at all you should know you get ndarrays out just like from a network. You’d just do the exact same thing and just use your existing normalizer.

SameDiff does not let you save the normalizer used when preparing the data as it is possible with dl4j.

This means that when I revertLabels on the IND array produced by output on the Android side, I do not get the actual values of the labels but the normalized values.

I guess I am trying to figure out what is the equivalent of revertLabels in samediff and how I carry over to the Android side the normalizer I used when prepraring data for the network.

I have one idea for solving this problem: When running inference in the Android app to revert labels use a normalizer from a network saved with dl4j. Do you think this would work?

What am I missing or doing wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [June 30, 2023, 9:55am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/54 "2023-06-30T09:55:34Z")

</div>

@adonnini sorry not quite getting the problem. What is stopping you from loading the normalizer separately? The normalizer has its own save and load methods.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 30, 2023, 11:16am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/55 "2023-06-30T11:16:12Z")

</div>

Sorry. You are right. Missing the obvious.

When do you think the upcoming release will be ready? I would like to try restoring the saved samediff network in my Android app and riun inference using it.

Thanks

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [June 30, 2023, 11:25am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/56 "2023-06-30T11:25:49Z")

</div>

Great just do that and you should be fine. Let me know if you have any other issues. Note that when you use dl4j normally you just restore the normalizer Samediff isn’t as easy to use there. That is one thing I could polish after the release.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 30, 2023, 11:35am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/57 "2023-06-30T11:35:08Z")

</div>

Thanks. I can save the normalizer using dl4j and retrieve it also using dl4j since the normalizer code is exactly the same in samediff and dl4j.

Please let me know about the new release when you have a chance.

Thanks

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [June 30, 2023, 12:20pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/58 "2023-06-30T12:20:57Z")

</div>

As it stands cpu is done just need to finish gpu. Right now I am just on vacation this week. Will be back after that and will publish M3 docs and release notes after testing.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [June 30, 2023, 12:36pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/59 "2023-06-30T12:36:16Z")

</div>

Sorry. I didn’t know that. Enjoy the rest of your vacation!

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [September 1, 2023, 8:53pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/60 "2023-09-01T20:53:47Z")

</div>

Hi Adam,  
Were you able to complete the M3 release process? Without a couple of fixes in the new release, I cannot test networks created with SameDiff in my Android application.  
Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [September 2, 2023, 1:57am UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/61 "2023-09-02T01:57:31Z")

</div>

@adonnini unfortunately not yet. I would announce it when I did. Sorry for the late reply just ping me as usual. Unfortunately, I’m still in the middle of cleaning up some technical debt yet. I’m investigating a fairly hairy aspect of the project that I won’t bother explaining unless you want a c++ lesson 🙂 Due to the enterprise usage and the productization plans I have the last year has been focused on stripping the framework down and right now I’m in the middle of a fairly large set of cuda changes. No rewriting anything but I am changing some aspect of the internals that’s been tricky to debug.

Much of that has to do with me rerunning the 1000s of tests the framework has over and over again trying to nail things like deallocation race conditions, improving tooling around debugging, improving build scripts.

Much of that work isn’t user facing or anything you’d even see on the surface beyond maybe me removing features or just general stability.

Along the way I’ve been documenting these things as well.

---

<div class="post-metadata">

**Author:** ![adonnini](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adonnini](https://community.konduit.ai/u/adonnini)\
**Post date:** [September 24, 2023, 4:54pm UTC](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633/62 "2023-09-24T16:54:13Z")

</div>

Hi Adam,  
I hope I am not being too much of a nuisance.  
How are things coming along with release 3?  
Thanks

[Previous page](https://community.konduit.ai/t/assign-value-to-a-placeholder/2633.md?page=2)
