Skip to content

Commit

Permalink
Merge pull request #501 from stweil/warn
Browse files Browse the repository at this point in the history
lstm: Remove several unused variables
  • Loading branch information
egorpugin authored Nov 26, 2016
2 parents d0213fa + b048794 commit 0df77e3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 9 deletions.
4 changes: 0 additions & 4 deletions lstm/lstmrecognizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ bool LSTMRecognizer::RecognizeLine(const ImageData& image_data, bool invert,
OutputStats(*outputs, &pos_min, &pos_mean, &pos_sd);
if (invert && pos_min < 0.5) {
// Run again inverted and see if it is any better.
float inv_scale;
NetworkIO inv_inputs, inv_outputs;
inv_inputs.set_int_mode(IsIntMode());
SetRandomSeed();
Expand Down Expand Up @@ -460,7 +459,6 @@ void LSTMRecognizer::DisplayForward(const NetworkIO& inputs,
const char* window_name,
ScrollView** window) {
#ifndef GRAPHICS_DISABLED // do nothing if there's no graphics
int x_scale = network_->XScaleFactor();
Pix* input_pix = inputs.ToPix();
Network::ClearWindow(false, window_name, pixGetWidth(input_pix),
pixGetHeight(input_pix), window);
Expand Down Expand Up @@ -595,7 +593,6 @@ void LSTMRecognizer::LabelsViaThreshold(const NetworkIO& output,
int width = output.Width();
int t = 0;
// Skip any initial non-char.
int label = null_char_;
while (t < width && NullIsBest(output, null_thr, null_char_, t)) {
++t;
}
Expand Down Expand Up @@ -688,7 +685,6 @@ BLOB_CHOICE_LIST* LSTMRecognizer::GetBlobChoices(
int col, int row, bool debug, const NetworkIO& output,
const UNICHARSET* target_unicharset, int x_start, int x_end,
float score_ratio) {
int width = x_end - x_start;
float rating = 0.0f, certainty = 0.0f;
int label = output.BestChoiceOverRange(x_start, x_end, UNICHAR_SPACE,
null_char_, &rating, &certainty);
Expand Down
1 change: 0 additions & 1 deletion lstm/lstmtrainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ Trainability LSTMTrainer::PrepareForBackward(const ImageData* trainingdata,
return UNENCODABLE;
}
targets->Resize(*fwd_outputs, network_->NumOutputs());
double text_error = 100.0;
LossType loss_type = OutputLossType();
if (loss_type == LT_SOFTMAX) {
if (!ComputeTextTargets(*fwd_outputs, truth_labels, targets)) {
Expand Down
1 change: 0 additions & 1 deletion lstm/networkio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ void NetworkIO::MaxpoolTimeStep(int dest_t, const NetworkIO& src, int src_t,
void NetworkIO::MaxpoolBackward(const NetworkIO& fwd,
const GENERIC_2D_ARRAY<int>& maxes) {
ASSERT_HOST(!int_mode_);
int width = fwd.Width();
Zero();
StrideMap::Index index(fwd.stride_map_);
do {
Expand Down
3 changes: 0 additions & 3 deletions lstm/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ void Parallel::Forward(bool debug, const NetworkIO& input,
src_transpose = &transposed_input_;
}
// Run each network, putting the outputs into result.
int input_offset = 0;
int out_offset = 0;
for (int i = 0; i < stack_size; ++i) {
stack_[i]->Forward(debug, input, src_transpose, scratch, result);
Expand Down Expand Up @@ -126,7 +125,6 @@ bool Parallel::Backward(bool debug, const NetworkIO& fwd_deltas,
out_deltas.init_to_size(stack_size, NetworkScratch::IO());
// Split the forward deltas for each stack element.
int feature_offset = 0;
int out_offset = 0;
for (int i = 0; i < stack_.size(); ++i) {
int num_features = stack_[i]->NumOutputs();
in_deltas[i].Resize(fwd_deltas, num_features, scratch);
Expand All @@ -153,7 +151,6 @@ bool Parallel::Backward(bool debug, const NetworkIO& fwd_deltas,
// back_deltas.
NetworkScratch::IO out_deltas;
int feature_offset = 0;
int out_offset = 0;
for (int i = 0; i < stack_.size(); ++i) {
int num_features = stack_[i]->NumOutputs();
in_deltas->CopyUnpacking(fwd_deltas, feature_offset, num_features);
Expand Down

0 comments on commit 0df77e3

Please sign in to comment.