Comments (4)
Same issue, struggling to create multi-dimensional tensors
from keras2cpp.
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.
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.
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)
- How to convert image to keras2cpp::Tensor? (Not really an Issue but a question)
- This project only support C
- This project only support std = c++17. Is there any other version? HOT 6
- Multi-class classification
- Assert error conv2d in dims != weight dims HOT 4
- Using it with qmake HOT 1
- Не собирается библиотека под UE4 HOT 3
- Не понимаю где косячу) or assert on BatchNormalization HOT 1
- VC++ dll HOT 1
- Convolutional networks HOT 1
- Error C2440 'initializing': cannot convert from 'initializer list' to 'keras2cpp::Tensor' HOT 2
- Inference result is different between keras model and c++
- Inference on c++ model fails: file cannot be read
- Cannot find test directory and files in that directory HOT 1
- embedding layer with mask_zero = True produces incorrect predictions
- VC++ Conv2D runtime error
- /
- Using from cpp project in VS2022 (Windows)
- tuple.index(x): x not in tuple HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras2cpp.