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

246 views
Skip to first unread message

auro tripathy

unread,
Aug 1, 2016, 1:10:29 PM8/1/16
to Caffe Users
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)


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 }
}

auro tripathy

unread,
Aug 5, 2016, 1:40:36 PM8/5/16
to Caffe Users
As was pointed out in #2033, the correct way to specify the data is T x N x ....
With that fix, the prototxt below works fine. 

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"
Message has been deleted

Md Nasir Uddin Laskar

unread,
Sep 10, 2016, 6:26:34 PM9/10/16
to Caffe Users
Thanks for posting your fix Tripathy. It was helpful.

zack pecenak

unread,
Sep 16, 2016, 1:07:17 PM9/16/16
to Caffe Users
Hello Trpiathy,

It appears your fix was to simply remove the lstm2 and lstm3 layers. Were you ever able to figure out how to get an LSTM network composed of multiple layers? When I add a second (or third) layer, my network outputs flat profiles. I am not finding many sources online using multiple lstm layers.


On Monday, August 1, 2016 at 10:10:29 AM UTC-7, auro tripathy wrote:
Reply all
Reply to author
Forward
0 new messages