Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 'Check failed' error when loading a toy LSTM prototxt file #4547

Closed
aurotripathy opened this issue Aug 1, 2016 · 3 comments
Closed

Comments

@aurotripathy
Copy link

aurotripathy commented Aug 1, 2016

Also posted on Caffe Users. However, looks like an issue internal to Caffe.

Below is the error. I don't understand the error message (2 vs. 2).

I0801 09:50:09.308823 21586 layer_factory.hpp:77] Creating layer lstm1_x_transform
I0801 09:50:09.308851 21586 net.cpp:91] Creating Layer lstm1_x_transform
I0801 09:50:09.308863 21586 net.cpp:425] lstm1_x_transform <- x
I0801 09:50:09.308879 21586 net.cpp:399] lstm1_x_transform -> W_xc_x
F0801 09:50:09.308907 21586 blob.hpp:122] Check failed: axis_index < num_axes() (2 vs. 2) axis 2 out of range for 2-D Blob with shape 320 1 (320)
*** Check failure stack trace: ***
Aborted (core dumped)

Here's how I load the prototxt file (derived from https://github.com/junhyukoh/caffe-lstm/blob/master/examples/lstm_sequence/lstm_short.prototxt).

solver = caffe.get_solver('solver.prototxt')

Here's the prototxt file in its entirety.

name: "LSTM"
input: "data"
input_shape { dim: 320 dim: 1 }
input: "clip"
input_shape { dim: 320 dim: 1 }
input: "label"
input_shape { dim: 320 dim: 1 }
layer {
  name: "Silence"
  type: "Silence"
  bottom: "label"
  include: { phase: TEST }
}
layer {
  name: "lstm1"
  type: "LSTM"
  bottom: "data"
  bottom: "clip"
  top: "lstm1"

  param {
    lr_mult: 1
  }
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }

  recurrent_param {
    num_output: 7
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "lstm2"
  type: "Lstm"
  bottom: "lstm1"
  bottom: "clip"
  top: "lstm2"

  recurrent_param {
    num_output: 7
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "lstm3"
  type: "Lstm"
  bottom: "lstm2"
  bottom: "clip"
  top: "lstm3"

  recurrent_param {
    num_output: 7
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "lstm3"
  top: "ip1"

  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "loss"
  type: "EuclideanLoss"
  bottom: "ip1"
  bottom: "label"
  top: "loss"
  include: { phase: TRAIN }
}

@aurotripathy
Copy link
Author

As was pointed out in #2033, the format for the input data is T x N ...
So the following toy lstm prototxt meets the validation checks.

 name: "TOY_LSTM"
input: "data"
# T = 320 time_steps, N = 1 streams, 1-D data
input_shape { dim: 320 dim: 1 dim: 1}
input: "clip"
input_shape { dim: 320 dim: 1 }
input: "label"
input_shape { dim: 320 dim: 1 }

layer {
  name: "Silence"
  type: "Silence"
  bottom: "label"
  include: { phase: TEST }
}

layer {
  name: "lstm"
  type: "LSTM"
  bottom: "data"
  bottom: "clip"
  top: "lstm"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  recurrent_param {
    num_output: 15
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}

layer {
  name: "ip"
  type: "InnerProduct"
  bottom: "lstm"
  top: "ip"
  inner_product_param {
    num_output: 1
    weight_filler {
      type: "gaussian"
      std: 0.1
    }
    bias_filler {
      type: "constant"
    }
  }
}

layer {
  name: "loss"
  type: "EuclideanLoss"
  bottom: "ip"
  bottom: "label"
  top: "loss"
  include: { phase: TRAIN }
}

@ubenz55555
Copy link

ubenz55555 commented Mar 6, 2018

HI @aurotripathy

it shows up error with

Iteration 4800, lr = 0.0001
F0306 20:33:55.743507 10364 recurrent_layer.cpp:187] Check failed: T_ == bottom[0]->shape(0) (320 vs. 2) input number of timesteps changed

do you know how to solve it ?

@elinx
Copy link

elinx commented Jul 27, 2018

@ubenz55555 I met the same problem, how do you solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants