Coder Social home page Coder Social logo

Comments (5)

ar4 avatar ar4 commented on July 25, 2024

Dear Abdullah,

I am delighted to hear that you enjoy Deepwave, but sorry that you experienced a problem with it. Thank you for taking the time to report it.

I have unfortunately not yet been able to reproduce the issue: I replaced the line nt = int(2 / dt) in the example with nt = int(1.5 / dt), but did not receive an error. Would it be possible for you to create and share a Colaboratory notebook where the error occurs?

-Alan

from deepwave.

alaliaa avatar alaliaa commented on July 25, 2024

Hi Alan,

You are right, 1.5 works fine. The error occurs when I make nt=int(1.3/dt), sorry my bad I put the wrong number in the first comment.

Currently I cannot share a Colaboratory notebook, I think my workstation just broke down. I am connecting to it remotely and suddenly I cannot connect anymore, so I need to go there and check it out.

If you still cannot reproduce the error, let me know. I will try to fix my workstation and share the notebook.

  • Abdullah

from deepwave.

ar4 avatar ar4 commented on July 25, 2024

Hi Abdullah,

Ah yes, I can reproduce the error with 1.3. This is in fact not caused by Deepwave, but by the normalization I use in the example. In the example I divide each receiver's recording by the maximum amplitude of that receiver as a demonstration of the kind of processing that you can add after wave propagation (and PyTorch will automatically calculate the effect it has on the gradient calculation). I was a bit careless, however, and didn't account for the possibility that a receiver could have zero amplitude at all times, in which case there will be a division by zero. You may fix it by replacing the line in the example code

batch_rcv_amps_pred_norm = batch_rcv_amps_pred / batch_rcv_amps_pred_max

with

batch_rcv_amps_pred_norm = batch_rcv_amps_pred / (batch_rcv_amps_pred_max.abs() + 1e-10)

Taking the absolute value of the maximum amplitude and adding 1e-10 in the denominator will ensure that the denominator is never zero, and so should solve the problem.

Thank you again for reporting this issue - I will fix the example code.

Please let me know if this resolves the problem for you.

-Alan

from deepwave.

alaliaa avatar alaliaa commented on July 25, 2024

Thank you,

Your solution work very well. I see where things went south.

Another solution can be to not normalizing the data, but the gradient. This is what I often do when I implement FWI. something like

mx = model.grad.abs().max()
model.grad = model.grad/mx
optimizer.step()

I just implement it and it worked, I do not know which one is more efficient though

Thank you again

from deepwave.

ar4 avatar ar4 commented on July 25, 2024

Excellent. Let me know if anything else goes wrong.

from deepwave.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.