Skip to content

AdamOptimizer #271

Closed
Closed

Description

@bpietroiu

I am trying to get CnnTextClassification to work with IsImportingGraph = false

In AdamOptimizer I found two problems.

  1. It does not override Optimizer._prepare so I get a NullReferenceException down the line, when LearningRateTensor is referenced
  2. After fixing 1, when running the generated graph, Session.Run returns status : 'var and delta do not have the same shape[41205,128] [6400,128] [[{{node loss/Adam/update_embeddings/ApplyGradientDescent}}]]'

I have no ideea what to do next.

Activity

  1. henon commented on Jun 17, 2019

    @henon
    Contributor

    When I try to fix errors in TF.NET I do it like this: I run the same program in PyCharm and in VisualStudio and set breakpoints to inspect. Ususally after simultaneously stepping through the code it becomes obvious where they digress.

  2. Oceania2018 commented on Jun 17, 2019

    @Oceania2018
    Member

    Can you PR your fixed 1? It will reduce my workload.

  3. added
    bug
    on Jun 17, 2019
  4. bpietroiu commented on Jun 17, 2019

    @bpietroiu
    ContributorAuthor

    Can you PR your fixed 1? It will reduce my workload.

    I have created a PR for it- CnnTextClassification debugging #272

  5. Oceania2018 commented on Jun 18, 2019

    @Oceania2018
    Member

    @bpietroiu Can you check the latest code?

  6. bpietroiu commented on Jun 24, 2019

    @bpietroiu
    ContributorAuthor

    @bpietroiu Can you check the latest code?

    tested with both IsImportingGraph true and false

    IsImportingGraph=True
    System.Exception: NodeDef mentions attr 'explicit_paddings' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=dilations:list(int),default=[1, 1, 1, 1]>; NodeDef: {{node conv2d/Conv2D}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

    IsImportingGraph=False
    System.Exception: Operation 'conv2d/Conv2D' has no attr named 'explicit_paddings'.
    at Tensorflow.Status.Check(Boolean throwException) in D:\sandbox\TensorFlow.NET\src\TensorFlowNET.Core\Status\Status.cs:line 48
    at Tensorflow.Operation.get_attr(String name) in D:\sandbox\TensorFlow.NET\src\TensorFlowNET.Core\Operations\Operation.cs:line 228
    at Tensorflow.Gradients.nn_grad._Conv2DGrad(Operation op, Tensor[] grads) in D:\sandbox\TensorFlow.NET\src\TensorFlowNET.Core\Gradients\nn_grad.cs:line 112
    --- End of inner exception stack trace ---

    On a side-note, something is happening with tensorflow.dll, in tensorflowlib\runtimes\win-x64\native i have a zero bytes file.

  7. Oceania2018 commented on Jun 24, 2019

    @Oceania2018
    Member
  8. bpietroiu commented on Jun 24, 2019

    @bpietroiu
    ContributorAuthor

    @bpietroiu Please replace tensorflow.dll with v1.14 https://github.com/SciSharp/TensorFlow.NET/tree/master/tensorflowlib

    tested with both IsImportingGraph true and false, NUM_EPOCHS=10

    IsImportingGraph=true
    loss: 0.39, Validation Accuracy: 0.94

    IsImportingGraph=false
    loss: 2.14, Validation Accuracy: 0.65

    The generated graph does not perform just as good as the imported one
    I will debug graph construction, side by side with the python one, to see where is the difference.

    are there any tools to compare two untrained graphs?

  9. Oceania2018 commented on Jun 24, 2019

    @Oceania2018
    Member

    I usually use JsonConvert to export the graph. You can also export and import to python, and check the graph https://github.com/SciSharp/TensorFlow.NET/wiki/Debugging.

  10. Oceania2018 commented on Jun 27, 2019

    @Oceania2018
    Member

    @bpietroiu Find any clue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions