Skip to content

Testing some gradients functions: - #307

Merged
Oceania2018 merged 1 commit into
SciSharp:masterfrom
sattisvar:testing-grads
Jul 24, 2019
Merged

Oceania2018 merged 1 commit into
SciSharp:masterfrom
sattisvar:testing-grads

Conversation

@sattisvar

Copy link
Copy Markdown
Contributor

Here are the functions tested

  • Concat
  • LGamma
  • Tanh
  • Slice /!\ Slice seems not to work causing an error System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.Int32'.

- Concat
- LGamma
- Tanh
- Slice
@Oceania2018
Oceania2018 self-requested a review July 24, 2019 15:12
@Oceania2018 Oceania2018 added the bug Something isn't working label Jul 24, 2019
@Oceania2018
Oceania2018 merged commit 930f601 into SciSharp:master Jul 24, 2019
@Oceania2018

Copy link
Copy Markdown
Member
import tensorflow as tf

a = tf.tanh(tf.constant([2.0, 3.0], shape = [2, 1 ]))
b = tf.strided_slice(a,
                tf.constant([0 ], tf.int32, [1]),
                tf.constant([1 ], tf.int32, [1]),
                tf.constant([1 ], tf.int32, [1]))
grad = tf.gradients(b, a)
with tf.Session() as sess:
    r = sess.run([grad, b])
    print(r)

Result:

2019-07-24 12:03:45.462041: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
[[array([[1.],
       [0.]], dtype=float32)], array([[0.9640276]], dtype=float32)]

@Oceania2018
Oceania2018 removed their request for review July 24, 2019 18:55
Oceania2018 added a commit that referenced this pull request Jul 26, 2019
* fixed a bug about unzip

* added a test case for MnistModelLoader

* cleared warnings in the UnitTest project

* Upgrade NumSharp with signature.

* Testing gradients function: (#307)

- Concat
- LGamma
- Tanh
- Slice

* Adding new ctor for `Session` (#309)

Meant to be a shortcut to directly set some basic configuration.

E.g.

```
var sessionOptions = new SessionOptions();
sessionOptions.SetConfig(new ConfigProto
{
   LogDevicePlacement = true,
   InterOpParallelismThreads = 4,
   GpuOptions = new GPUOptions
   {
      AllowGrowth = true,
      PerProcessGpuMemoryFraction = 0.12
   }
});
var session = tf.Session(sessionOptions);
```

Adding `AbsGrad`

To be aligned with Tensorflow, introducing also `Sign` operation
and its gradient.

* fix strided_slice_grad type convention error. #307

* added a static load method for MnistModelLoader

* adjusted the assembly name for hub

* add Prediction function for Transfer Learning

* fixed the path combining issue

* Init TensorFlow.Text project. put all UnitTest and Example into one project.

* Predict image category in bootleneck file.

* Adding `IsNan` operation (#315)

Exposing also the `IsFinite` one.
Unit testing both operations.

* change bottleneck file to raw image as input for transfer learning.

* remove unnecessary projects (#316)

* implementing some additional methods (#317)

* got rid off the reference to the TF.NET

* updated project file for packaging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants