Advertisement
Trainlover08

Dot Product Function

Apr 11th, 2024 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. vector<vector<float>> dotProduct (vector<vector<float>> inputs, vector<vector<float>> weights, vector<float> biases) {
  2.     short col_count = inputs.size();
  3.     vector<vector<float>> output (col_count);
  4.     for(short i = 0; i < col_count; ++i){
  5.         short row_count = inputs[i].size();
  6.         output[i].resize(row_count);
  7.         for(short k = 0; k < row_count; ++k){
  8.             output[i][k] = inputs[i][k] * weights[i][k] + biases[i];
  9.         }
  10.     }
  11.     return output;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement