Code Monkey home page Code Monkey logo

dcpp's Issues

No comments in the code

Could you please add comments inside the code to explain how to construct the differentiable virtual memory?

Infinite diffraction is better.

Try "return​ x / ​foo​(x / ​2​, y) + y * ​foo​(x, y / 4);"
It's cpp and binary, you know..

Infinite differentials + free integration at signature, just test it with 1/x and see if you find 2/x. It's easy.

How to calculate derivative when multiplying matrixes with Eigen?

Considering the following snippet of code:

  #include <iostream>
  #include <dCpp.h> 
  #include <dEigen.h>
  #include <Eigen/Dense>

  #define BATCH_SIZE 3
  #define NUM_FEATURES 2
  #define NUM_CLASSES 4

  template<typename A, typename B>
  void print_derivative(A &input, B &w) {
      auto nRows = input.rows();
      auto nCols = input.cols();
      Eigen::MatrixXd toprint(nRows, nCols);
      for (size_t i = 0; i < nRows; ++i){
          for (size_t j = 0; j < nCols; ++j) {
              toprint(i, j) = input(i, j).d(&w);
          }
      }
      std::cout << toprint << std::endl;
  }

  int main() {
      dCpp::initSpace(1);

      // x.W + b
      Eigen::Matrix<dCpp::var, BATCH_SIZE, NUM_FEATURES> x;
      x = Eigen::Matrix<dCpp::var, BATCH_SIZE, NUM_FEATURES>::Ones(BATCH_SIZE, 
  NUM_FEATURES);
      dCpp::init(x);

      Eigen::Matrix<dCpp::var, NUM_FEATURES, NUM_CLASSES> w;
      w = Eigen::Matrix<dCpp::var, NUM_FEATURES, NUM_CLASSES>::Zero(NUM_FEATURES, NUM_CLASSES);
      dCpp::init(w);

      Eigen::Matrix<dCpp::var, BATCH_SIZE, NUM_CLASSES> b;
      b = Eigen::Matrix<dCpp::var, BATCH_SIZE, NUM_CLASSES>::Zero(BATCH_SIZE, NUM_CLASSES);
      dCpp::init(b);


      Eigen::Matrix<dCpp::var, BATCH_SIZE, NUM_CLASSES> y = x*w + b;
      print_derivative(y, w);

      return 0;
  }

The previous snippet of code does not compile because of the following line:

  toprint(i, j) = input(i, j).d(&w);

My question is how, while leveraging dCpp, can I obtain a matrix representing the first derivate of y in respect to w?

Is dCpp thread safe?

Hi,

what would be the implications if one runs dCpp in a multithreaded environment?

Auto-initializing all instances of var as differetiable

Hi,

I'm playing a bit with your nice AD tool and I'm having a bug with C++ operator and expressions.

Please have a look to https://gist.github.com/dcoeurjo/ce2b7f5e16edd348b7e4ca061ae6ceb5

For short: I have four points in the plane and I compute a kind of energy (sum of squared euclidean distance to a anchor point) and I want to differentiate this energy w.r.t. the anchor point.

If I expand the for loop when computing the energy (line 28), everything looks fine. When I use a for loop (line 17), then the differentiation fails (returning 0.0 for de/dx for instance). In terms of C++ operators, both energy expressions look similar.

Would you have any idea ?

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.