question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does this really have auto diff?

See original GitHub issue

I saw that for

//============================================
// Loss functions
case class SoftmaxLoss(actual: Variable, target: Variable) extends Function {
  val x: Tensor = actual.data
  val y: Tensor = target.data.T

  val shiftedLogits: Tensor = x - ns.max(x, axis = 1)
  val z: Tensor = ns.sum(ns.exp(shiftedLogits), axis = 1)
  val logProbs: Tensor = shiftedLogits - ns.log(z)
  val n: Int = x.shape.head
  val loss: Double = -ns.sum(logProbs(ns.arange(n), y)) / n

  override def forward(): Variable = Variable(Tensor(loss), Some(this))

  override def backward(gradOutput: Variable /* not used */ ): Unit = {
    val dx = ns.exp(logProbs)
    dx(ns.arange(n), y) -= 1
    dx /= n

    actual.backward(Variable(dx))
  }
}

the backward is manually implemented,which should have been automatically derived

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
koen-dejonghecommented, Dec 31, 2018

Implicitly, I think so, yes. The README has a detailed description of how auto diff works. It’s all about Variables and Functions.

0reactions
doofincommented, Dec 31, 2018

thanks,it works! Is auto diff in this project implemented with tape based mechanism?

Read more comments on GitHub >

github_iconTop Results From Across the Web

autodiff
autodiff is a C++17 library that uses modern and advanced programming techniques to enable automatic computation of derivatives in an efficient, easy, and ......
Read more >
Automatic differentiation - Wikipedia
Automatic differentiation is distinct from symbolic differentiation and numerical differentiation. Symbolic differentiation faces the difficulty of converting ...
Read more >
Differential Blood Count: Procedure and Results - WebMD
A differential blood count is a test that measures your white blood cell. Learn more about why it's done, reference ranges, and more....
Read more >
What is Automatic Differentiation? - YouTube
This short tutorial covers the basics of automatic differentiation, a set of techniques that allow us to efficiently compute derivatives of ...
Read more >
Complete Blood Count with Differential - Health Encyclopedia
This test is known as red cell distribution width (RDW, RDW-CV, or RDW-SD). For instance, you may have greater differences in red blood...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found