Skip to content

Commit

Permalink
修复多分类问题 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuqiang authored and levyfan committed May 29, 2019
1 parent 7253884 commit 235542d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cuBERT/op_out/AdditionalOutputLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ namespace cuBERT {
this->handle = handle;
this->hidden_size = hidden_size;
this->num_labels = num_labels;

std::cerr << "hidden_size:" << this->hidden_size << " num_labels:" << this->num_labels << std::endl;

this->output_weights = static_cast<T *>(cuBERT::malloc(sizeof(T) * hidden_size));
cuBERT::memcpy(this->output_weights, output_weights, sizeof(T) * hidden_size, 1);
this->output_weights = static_cast<T *>(cuBERT::malloc(sizeof(T) * hidden_size * this->num_labels));
cuBERT::memcpy(this->output_weights, output_weights, sizeof(T) * hidden_size * this->num_labels, 1);

if (output_bias != nullptr) {
this->output_bias = static_cast<T *>(cuBERT::malloc(sizeof(T) * num_labels * max_batch_size));
Expand All @@ -25,6 +27,7 @@ namespace cuBERT {
} else {
this->output_bias = nullptr;
}

}

template <typename T>
Expand Down
3 changes: 3 additions & 0 deletions src/cuBERT/op_out/AdditionalOutputLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include <cstddef>


#include "cuBERT/op/Softmax.h"

namespace cuBERT {

/**
Expand Down

0 comments on commit 235542d

Please sign in to comment.