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
ValueError: total size of new array must be unchanged #2270
Comments
I got this report from someone else. I'm not able to reproduce it. To help On Wed, Nov 19, 2014 at 1:55 PM, Alex Rothberg notifications@github.com
|
from pylearn2.config import yaml_parse
model_yl = """
!obj:pylearn2.models.mlp.MLP {input_space: !obj:pylearn2.space.Conv2DSpace {shape: [
300, 400], num_channels: 1}, layers: [!obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h0', output_channels: 7, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365}, !obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h1', output_channels: 16, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365}, !obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h2', output_channels: 32, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365, init_bias: 0.1}, !obj:pylearn2.models.maxout.Maxout {
layer_name: 'h6', num_units: 57, num_pieces: 2, irange: 0.0575059125935, max_col_norm: 2.0,
init_bias: 1.}, !obj:pylearn2.models.mlp.Softmax {max_col_norm: 3.9365, layer_name: 'y',
n_classes: 2, irange: 0.005000}]}
"""
yaml_parse.load(model_yl) |
This do not reproduce the problem here. Can you tell me which version of On Wed, Nov 19, 2014 at 2:32 PM, Alex Rothberg notifications@github.com
|
I am seeing this issue on pylearn2 lisa-lab/pylearn2@a23672b (master) and Theano 4c513ba (master). |
I was missing that the Theano flags need to be floatX=float32 and On Wed, Nov 19, 2014 at 2:56 PM, Alex Rothberg notifications@github.com
|
In response to your replies in regards to changing the type.py in theano.gof, I got the following. I'm guessing that this does not help you any further: Input shape: (128, 128) File "", line 1, in File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 586, in runfile File "D:/Experiments/Papers/PatholCAD/scripts/trainConvolutionNetwork.py", line 14, in File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 338, in load File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 281, in _instantiate File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 230, in _instantiate_proxy_tuple File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 230, in File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 281, in _instantiate File "D:/Code/thirdpartylibs/pylearn2\pylearn2\config\yaml_parse.py", line 231, in _instantiate_proxy_tuple File "D:/Code/thirdpartylibs/pylearn2\pylearn2\utils\call_check.py", line 99, in checked_call File "D:/Code/thirdpartylibs/pylearn2\pylearn2\models\mlp.py", line 464, in init File "D:/Code/thirdpartylibs/pylearn2\pylearn2\models\mlp.py", line 529, in _update_layer_input_spaces File "D:/Code/thirdpartylibs/pylearn2\pylearn2\sandbox\rnn\models\mlp_hook.py", line 334, in outer File "D:/Code/thirdpartylibs/pylearn2\pylearn2\sandbox\rnn\models\mlp_hook.py", line 334, in outer File "D:/Code/thirdpartylibs/pylearn2\pylearn2\models\mlp.py", line 3066, in set_input_space File "D:/Code/thirdpartylibs/pylearn2\pylearn2\models\mlp.py", line 3006, in initialize_output_space File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\gof\graph.py", line 431, in eval File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\function_module.py", line 595, in call File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\debugmode.py", line 2096, in deco File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\debugmode.py", line 1806, in f File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\debugmode.py", line 880, in _lessbroken_deepcopy File "C:\Python27\lib\copy.py", line 189, in deepcopy Error: un(deep)copyable object of type <type 'PyCObject'> My code is similar to that of cancan101, so you should get the same issue with that. If there is anything else I can do to help, let me know. Kind regards, Geert |
I have a partial fix in a branch: https://github.com/nouiz/Theano/tree/mixed It fix the crash, but now the tests fails. So I need to fix them. With this branch, your example do not crash anymore. |
Hi Fred, After applying your fix it work up till right after epoch 0, as soon as it starts with epoch 1 I get: .... File "", line 1, in File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 586, in runfile File "D:/Experiments/Papers/PatholCAD/scripts/trainConvolutionNetwork.py", line 15, in File "D:/Code/thirdpartylibs/pylearn2\pylearn2\train.py", line 207, in main_loop File "D:/Code/thirdpartylibs/pylearn2\pylearn2\training_algorithms\sgd.py", line 453, in train File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\function_module.py", line 605, in call File "C:\Python27\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\function_module.py", line 595, in call RuntimeError: GpuDnnPoolGrad: error doing operation: An incorrect value was passed in. HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'. |
Thanks for the info. The example I had didn't cover this case. This mean A workaround is to not use the cudnn pooling for now. This can be done with On Wed, Nov 19, 2014 at 6:17 PM, GeertLitjens notifications@github.com
|
Just to tell that yesterday we disabled this fonctionality in Theano. So if On Thu, Nov 20, 2014 at 9:18 AM, Frédéric Bastien <
|
Okay. Hopefully you are to turn the example I made into a unit test. On Fri Nov 21 2014 at 2:00:46 PM Frédéric Bastien notifications@github.com
|
Can't use pylearn2 stuff in Theano. But I'll make sure to cover the On Fri, Nov 21, 2014 at 2:06 PM, Alex Rothberg notifications@github.com
|
Understood on pylearn2. Wouldn't want circular dependencies. On Fri Nov 21 2014 at 2:08:31 PM Frédéric Bastien notifications@github.com
|
We reenabled this funcitonality in gh-2281. The consequence of the bug could be crash or that we do ignore the border when we where asked to do not ignore it. |
I think with master I am now seeing:
|
And here is the python code that replicates the issue: from pylearn2.config import yaml_parse
import numpy as np
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.config import yaml_parse
y_labels = 4
labels = [0] * 100
y = np.array(labels)[:,np.newaxis]
y[0] = 1
y[0] = 2
y[0] = 3
train_set = DenseDesignMatrix(topo_view=np.zeros((100,300,400,1)), y=y, y_labels=y_labels)
valid = DenseDesignMatrix(topo_view=np.zeros((100,300,400,1)), y=y, y_labels=y_labels)
model_yl = """
!obj:pylearn2.models.mlp.MLP {input_space: !obj:pylearn2.space.Conv2DSpace {shape: [
300, 400], num_channels: 1}, layers: [!obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h0', output_channels: 7, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365}, !obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h1', output_channels: 16, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365}, !obj:pylearn2.models.mlp.ConvRectifiedLinear {
layer_name: 'h2', output_channels: 32, irange: .05, kernel_shape: [3, 3], pool_shape: [
2, 2], pool_stride: [2, 2], max_kernel_norm: 1.9365, init_bias: 0.1}, !obj:pylearn2.models.maxout.Maxout {
layer_name: 'h6', num_units: 57, num_pieces: 2, irange: 0.0575059125935, max_col_norm: 2.0,
init_bias: 1.}, !obj:pylearn2.models.mlp.Softmax {max_col_norm: 3.9365, layer_name: 'y',
n_classes: 2, irange: 0.005000}]}
"""
model = yaml_parse.load(model_yl)
train_yml = """
!obj:pylearn2.train.Train {dataset: !import '__main__.train_set',
model: null, algorithm: !obj:pylearn2.training_algorithms.sgd.SGD {batch_size: 10,
learning_rate: 0.059662, learning_rule: !obj:pylearn2.training_algorithms.learning_rule.Momentum {
init_momentum: 0.15}, cost: !obj:pylearn2.costs.cost.SumOfCosts {costs: [!obj:pylearn2.models.mlp.WeightDecay {
coeffs: [0.0, 0.0, 0.0, 0.0, 0.012569075841283767]}, !obj:pylearn2.costs.mlp.dropout.Dropout {
input_include_probs: {'h0': 1, 'h1': 1, 'h2': 1}, input_scales: {'h0': 1,
'h1': 1, 'h2': 1}}]}, monitor_iteration_mode: "even_shuffled_sequential",
train_iteration_mode: "even_shuffled_sequential", monitoring_dataset: {'valid': !import '__main__.valid'},
termination_criterion: !obj:pylearn2.termination_criteria.And {criteria: [!obj:pylearn2.termination_criteria.MonitorBased {
channel_name: "valid_y_misclass", prop_decrease: 0.01, N: 30}, !obj:pylearn2.termination_criteria.EpochCounter {
max_epochs: 50, new_epochs: false}]}}, extensions: [
!obj:pylearn2.training_algorithms.learning_rule.MomentumAdjustor {
start: 1, saturate: 40, final_momentum: 0.60}, !obj:pylearn2.training_algorithms.sgd.LinearDecayOverEpoch {
start: 20, saturate: 100, decay_factor: 0.1}
],
}
"""
train = yaml_parse.load(train_yml)
train.model = model
train.main_loop() |
Sometime between 52cb8ec and d8ffecc I started getting:
The text was updated successfully, but these errors were encountered: