Skip to content

Random seed handling more simular to python - #762

Merged
Esther2013 merged 5 commits into
SciSharp:masterfrom
Sebastian-roko:random_seed
Feb 23, 2021
Merged

Esther2013 merged 5 commits into
SciSharp:masterfrom
Sebastian-roko:random_seed

Conversation

@Sebastian-roko

Copy link
Copy Markdown
Contributor

This pull request modifies the global / operation seed handling to be more equivalent to the python source. This affects mostly the method random_seed.get_seed (python source random_seed.py). For eager mode, some new fields were added to class Context to replicate the corresponding python source.
Finally this fixes passing the seed/seed2 arguments to method RandomShuffle.

@Oceania2018

Copy link
Copy Markdown
Member

@Sebastian-roko Can you resolve the confilict?

@Oceania2018
Oceania2018 removed their request for review February 23, 2021 14:12
@Sebastian-roko

Sebastian-roko commented Feb 23, 2021 •

Copy link
Copy Markdown
Contributor Author

@Sebastian-roko Can you resolve the confilict?

@Oceania2018 Do you mean a git merge conflict? GitHub does not show any merge conflicts.
Regarding the failing tests - there seems to be a problem with the tensorflow.dll not being found. This problem seems not correlated to this pr.

@Oceania2018

Copy link
Copy Markdown
Member

image

@Esther2013
Esther2013 merged commit a22c52b into SciSharp:master Feb 23, 2021
@Oceania2018

Copy link
Copy Markdown
Member

When I run examples project, it throws error below

2/26/2021 4:02:26 PM Starting Image Classification (Keras)
C:\Users\haipi\AppData\Local\Temp\flower_photos\flower_photos.tgz already exists.
Found 3670 files belonging to 5 classes.
Using 2936 files for training.
Found 3670 files belonging to 5 classes.
Using 734 files for validation.
2021-02-26 10:02:34.611834: W tensorflow/core/framework/op_kernel.cc:1763] OP_REQUIRES failed at whole_file_read_ops.cc:116 : Not found: NewRandomAccessFile failed to Create/Open:  : The system cannot find the path specified.
; No such process
2021-02-26 10:02:34.613274: W tensorflow/core/framework/op_kernel.cc:1763] OP_REQUIRES failed at whole_file_read_ops.cc:116 : Not found: NewRandomAccessFile failed to Create/Open:  : The system cannot find the path specified.
; No such process
2021-02-26 10:02:34.615599: W tensorflow/core/kernels/data/cache_dataset_ops.cc:757] The calling iterator did not fully read the dataset being cached. In order to avoid unexpected truncation of the dataset, the partially cached contents of the dataset will be discarded. This can happen if you have an input pipeline similar to `dataset.cache().take(k).repeat()`. You should use `dataset.take(k).cache().repeat()` instead.
Tensorflow.TensorflowException: NewRandomAccessFile failed to Create/Open:  : The system cannot find the path specified.; No such process
         [[{{node ReadFile}}]]
   at Tensorflow.Eager.EagerRunner.TFE_FastPathExecute(FastPathOpExecInfo op_exec_info) in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Eager\EagerRunner.TFE_FastPathExecute.cs:line 144
   at Tensorflow.Contexts.Context.<>c__DisplayClass51_0.<ExecuteOp>b__1() in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Contexts\Context.ExecuteOp.cs:line 55
   at Tensorflow.Contexts.Context.ExecuteOp(String OpType, String Name, ExecuteOpArgs args) in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Contexts\Context.ExecuteOp.cs:line 101
   at Tensorflow.dataset_ops.iterator_get_next(Tensor iterator, TF_DataType[] output_types, TensorShape[] output_shapes, String name) in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Operations\dataset_ops.cs:line 299
   at Tensorflow.OwnedIterator.next() in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Data\OwnedIterator.cs:line 38   at Tensorflow.DatasetV2.GetEnumerator()+MoveNext() in D:\SciSharp\TensorFlow.NET\src\TensorFlowNET.Core\Data\DatasetV2.cs:line 133
   at TensorFlowNET.Examples.ImageClassificationKeras.PrepareData() in D:\SciSharp\SciSharp-Stack-Examples\src\TensorFlowNET.Examples\ImageProcessing\ImageClassificationKeras.cs:line 102
   at TensorFlowNET.Examples.ImageClassificationKeras.Run() in D:\SciSharp\SciSharp-Stack-Examples\src\TensorFlowNET.Examples\ImageProcessing\ImageClassificationKeras.cs:line 37
   at TensorFlowNET.Examples.Program.RunExamples(String key, IExample[] examples) in D:\SciSharp\SciSharp-Stack-Examples\src\TensorFlowNET.Examples\Program.cs:line 89
2/26/2021 4:02:35 PM Completed Image Classification (Keras)

Not sure if it's related to this PR.

Reproduce: run the all examples twice at least.

@Sebastian-roko

Copy link
Copy Markdown
Contributor Author

@Oceania2018 While the new random seed handling is indeed used in the ImageClassificationKeras sample, I can't reproduce that exception. Furthermore, the error indicates an I/O problem (missing file); that doesn't seem to be related to this pull request.

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

Successfully merging this pull request may close these issues.

3 participants