Code Monkey home page Code Monkey logo

Comments (4)

fthielke avatar fthielke commented on August 30, 2024

Yes, currently our only documentation are the Readme and comments in the code.

Afaik, tinydnn's convolutional layer supports the same parameters as our Conv2D, so I suppose you would want to instantiate a CompiledNN model with just that one layer.
The problem is though that we currently only support loading Keras models without the possibility of constructing a Model yourself, which admittedly is a needless constraint.

from compilednn.

jayenashar avatar jayenashar commented on August 30, 2024

I think the only extra parameter in tiny_dnn would be dilation, which I saw somewhere is not supported in CompiledNN. But that's ok as most of our layers have no dilation.

I thought I could use the Conv2DCompiler class directly, but I couldn't figure out how. I looked at https://github.com/bhuman/CompiledNN/blob/master/Src/CompiledNN/CompiledNN.cpp#L160 as well.

from compilednn.

ahasselbring avatar ahasselbring commented on August 30, 2024

You can also compile a single node, see for example https://github.com/bhuman/CompiledNN/blob/master/Tests/Layers/UpSampling2D.cpp. I have an unfinished Conv2D test, this an excerpt from it:

  static const Node& buildNode(Conv2DLayer* l, const std::array<unsigned int, 2>& strides, const std::array<unsigned int, 2>& kernelSize,
                               bool hasBiases, ActivationFunctionId activation, PaddingType padding, unsigned int filters,
                               unsigned int height, unsigned int width, unsigned int channels)
  {                               
    l->nodes.clear();
    l->strides = strides;                                           
    l->weights.reshape(kernelSize[0], kernelSize[1], channels, filters);
    l->biases.resize(hasBiases ? filters : 0);
    l->hasBiases = hasBiases;                                         
    l->activationId = activation;
    l->padding = padding;
     
    l->nodes.emplace_back(l);
    Node& n = l->nodes.back();
    n.inputs.emplace_back(nullptr, 0, 0);
    n.inputDimensions.push_back({height, width, channels});
    l->calcOutputDimensions(n);                 
    for(std::size_t i = 0; i < n.outputDimensions.size(); ++i)
      n.outputs.emplace_back(l, 0, i);
    return n;
  }

called by

CompiledNN c;
Conv2DLayer l;
const Node& n = buildNode(&l, {stride, stride}, {kernelSize, kernelSize}, true, ...);
// ... copy weights to l.weights, copy biases to l.biases
c.compile(n, CompilationSettings());
// ... fill c.input(0)
c.apply();
// ... obtain output from c.output(0)

from compilednn.

jayenashar avatar jayenashar commented on August 30, 2024

oh fantastic. i will figure out how to make this work as a tiny_dnn layer and report back.

from compilednn.

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.