Git Product home page Git Product logo

Comments (4)

joeycurnutt avatar joeycurnutt commented on July 18, 2024

Same issue, struggling to create multi-dimensional tensors

from keras2cpp.

joeycurnutt avatar joeycurnutt commented on July 18, 2024

Try Tensor in({1, 28, 28, 1})
That seemed to work for me but I am lost on how to input data into that tensor once you have formed it. Hope that helps a little.

from keras2cpp.

joeycurnutt avatar joeycurnutt commented on July 18, 2024

Hi again, after some more experimentation, I found a tedious but seemingly working solution for my problem. I'm using a 3d tensor of shape (1, 1, 16) for an LSTM, and formatted like this:
// Create a 3D Tensor on length 16 for input data.
Tensor in{1, 1, 16};
in.data_[0] = reflectivity;
in.data_[1] = echoDist;
in.data_[2] = redx;
in.data_[3] = redy;
in.data_[4] = redSize;
in.data_[5] = bluex;
in.data_[6] = bluey;
in.data_[7] = blueSize;
in.data_[8] = yellowx;
in.data_[9] = yellowy;
in.data_[10] = yellowSize;
in.data_[11] = imu_theta;
in.data_[12] = imu_accelx;
in.data_[13] = imu_accely;
in.data_[14] = liftpos;
in.data_[15] = hook_state;
// Run prediction.
Tensor out = model(in);
result = out.data_[0]
Note I get my result this way because my output is a single value. Your "output" code may be different. I know this is late but hope this helps you and any future users.

from keras2cpp.

joeycurnutt avatar joeycurnutt commented on July 18, 2024

And last thing, forgot to mention I removed the "kassert" and all related lines on around line 66 of the tensor.cc file.

from keras2cpp.

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.