{
  "id": 4615,
  "title": "lcn.py: NotImplementedError: The image and the kernel must have the same type.inputs(float32), kerns(float64)",
  "url": "/competitions/challenges-in-representation-learning-multi-modal-learning/discussion/4615",
  "author_name": "",
  "post_date": "2013-05-17T15:12:55.250Z",
  "votes": null,
  "comment_count": 6,
  "views": 6267,
  "content": "<p>Hi,</p>\r\n<p></p>\r\n<p>When I tried running the lcn.py for the public_test, the following error message was displayed: &quot;NotImplementedError: The image and the kernel must have the same type.inputs(float32), kerns(float64)&quot;.</p>\r\n<p>I fixed this by changing every&nbsp;dtype='float32' to&nbsp;dtype='float64'. Should I expect any issues because of this change?</p>\r\n<p></p>\r\n<p></p>",
  "messages": [
    {
      "id": "24420",
      "postDate": "05/17/2013 15:12:55",
      "content": "<p>Hi,</p>\r\n<p></p>\r\n<p>When I tried running the lcn.py for the public_test, the following error message was displayed: &quot;NotImplementedError: The image and the kernel must have the same type.inputs(float32), kerns(float64)&quot;.</p>\r\n<p>I fixed this by changing every&nbsp;dtype='float32' to&nbsp;dtype='float64'. Should I expect any issues because of this change?</p>\r\n<p></p>\r\n<p></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "24425",
      "postDate": "05/17/2013 16:05:52",
      "content": "<p>I got the same error when I first ran it.&nbsp;&nbsp; I changed float32 to float64 on the following line:</p>\r\n<p>X = T.TensorType(dtype='float32', broadcastable=(True, False, False, True))()</p>\r\n<p>That seemed to fix things, and it did not cause any adverse issues that I am aware of.&nbsp; I now see that there is another float32 later in the code that I did not change.&nbsp; So I don't know about that one.</p>\r\n<p>&nbsp;</p>\r\n<p>Steve</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "24444",
      "postDate": "05/17/2013 20:40:14",
      "content": "<p>Another generic method of 'forcing' use of 32-bit floating point numbers is passing it with THEANO_FLAGS.</p>\r\n<pre>THEANO_FLAGS=&quot;theano_floatx=theano_float64&quot; python file.py option1 option2 ...\r\n</pre>\r\n<p>I have experienced loss of precision (and hence smaller accuracy) using this.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "26161",
      "postDate": "06/24/2013 08:36:58",
      "content": "<p>i just could't figure out the <a href=\"http://www.rasteredge.com/how-to/vb-net-imaging/image-converting/\">\r\nimage type vb.net</a> they are using or i will make some change to prevent this from happening.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "33587",
      "postDate": "11/11/2013 22:26:23",
      "content": "<p>To use GPU you must use float32. I always have my theano.config.floatX set to float32.&nbsp;The errors you saw here are because I forget to test my code with theano.config.floatX set to float64. It's my fault and I apologize for that.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "112391",
      "postDate": "03/20/2016 20:27:03",
      "content": "<p>I wana know how you fix it?</p>",
      "rawMarkdown": "I wana know how you fix it?",
      "votes": null
    },
    {
      "id": "112394",
      "postDate": "03/20/2016 20:49:31",
      "content": "<p>I fixed it by changing the .theanorc setting floatx=float32</p>",
      "rawMarkdown": "I fixed it by changing the .theanorc setting floatx=float32",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 24425,
      "author_name": "breakfastpirate",
      "author_url": "",
      "post_date": "05/17/2013 16:05:52",
      "content": "<p>I got the same error when I first ran it.&nbsp;&nbsp; I changed float32 to float64 on the following line:</p>\r\n<p>X = T.TensorType(dtype='float32', broadcastable=(True, False, False, True))()</p>\r\n<p>That seemed to fix things, and it did not cause any adverse issues that I am aware of.&nbsp; I now see that there is another float32 later in the code that I did not change.&nbsp; So I don't know about that one.</p>\r\n<p>&nbsp;</p>\r\n<p>Steve</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 24444,
      "author_name": "sjuvekar",
      "author_url": "",
      "post_date": "05/17/2013 20:40:14",
      "content": "<p>Another generic method of 'forcing' use of 32-bit floating point numbers is passing it with THEANO_FLAGS.</p>\r\n<pre>THEANO_FLAGS=&quot;theano_floatx=theano_float64&quot; python file.py option1 option2 ...\r\n</pre>\r\n<p>I have experienced loss of precision (and hence smaller accuracy) using this.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 26161,
      "author_name": "fiimage",
      "author_url": "",
      "post_date": "06/24/2013 08:36:58",
      "content": "<p>i just could't figure out the <a href=\"http://www.rasteredge.com/how-to/vb-net-imaging/image-converting/\">\r\nimage type vb.net</a> they are using or i will make some change to prevent this from happening.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 33587,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "11/11/2013 22:26:23",
      "content": "<p>To use GPU you must use float32. I always have my theano.config.floatX set to float32.&nbsp;The errors you saw here are because I forget to test my code with theano.config.floatX set to float64. It's my fault and I apologize for that.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 112391,
      "author_name": "",
      "author_url": "",
      "post_date": "03/20/2016 20:27:03",
      "content": "<p>I wana know how you fix it?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 112394,
      "author_name": "",
      "author_url": "",
      "post_date": "03/20/2016 20:49:31",
      "content": "<p>I fixed it by changing the .theanorc setting floatx=float32</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "24420": "",
    "24425": "",
    "24444": "",
    "26161": "",
    "33587": "",
    "112391": "I wana know how you fix it?",
    "112394": "I fixed it by changing the .theanorc setting floatx=float32"
  },
  "source": "meta"
}