简体   繁体   English

即使我用 int32 或 float32 编辑 dtype,我如何修复尺寸我得到同样的错误?

[英]How can I fix dimension i got the same error even i edit dtype with int32 or float32?

How can I fix this problem please?请问我该如何解决这个问题?

dtype_attr = getattr(initializer, 'dtype', None)
if dtype is not None and dtype_attr is not None \
        and numpy.dtype(dtype) != numpy.dtype(dtype_attr):
    raise ValueError(
        'dtype mismatch: {} != {}'.format(dtype, dtype_attr))
if dtype is None:
    dtype = dtype_attr
dtype = chainer.get_dtype(dtype)
array = xp.empty(shape, dtype=dtype)   
initializer(array)
return array

Error:错误:

File "/usr/local/lib/python3.6/dist-packages/chainer/initializers/ init .py", line 50, in generate_array array = xp.empty(shape, dtype=dtype) ValueError: sequence too large;文件“/usr/local/lib/python3.6/dist-packages/chainer/initializers/init .py”,第 50 行,在 generate_array 数组 = xp.empty (shape, dtype=dtype) ValueError: sequence too large; cannot be greater than 32不能大于 32

"sequence too large error means that you are creating a multidimension array that has a dimension larger than 32. For example: np.empty([1]*33) will raise this error." “序列太大错误意味着您正在创建一个维度大于 32 的多维数组。例如:np.empty([1]*33) 将引发此错误。” as explained by the user HYRT here: Numpy array: sequence too large正如用户HYRT所解释的那样: Numpy 数组:序列太大

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决 value too large for dtype('float32') 错误? 熊猫 - How can i solve the value too large for dtype('float32') error? Pandas 如何将int32张量转换为float32 - How to cast int32 tensor to float32 ValueError: Tensor 转换请求 dtype int32 for Tensor with dtype float32 - LSTM Implementation(tensorflow 2.0.0) - ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32 - LSTM Implementation( tensorflow 2.0.0) 从float32-> float64返回float32会失去精度吗? - Can I lose precision going from float32 -> float64 back to float32? 如何修复 LDAviz 中的“KeyError: dtype('float32')' - How to fix 'KeyError: dtype('float32')' in LDAviz 将Float32格式的数据提取到int32 - Extracting data which is in Float32 format to int32 将float32转换为等价的int32 - Converting float32 to bit-equivalent int32 当我尝试在Tensorflow中调整图像大小时,如何解决“ TypeError:x和y必须具有相同的dtype,得到tf.uint8!= tf.float32” - how to fix “TypeError: x and y must have the same dtype, got tf.uint8 != tf.float32” when I try to resize an image in Tensorflow 如何解决错误“dtype('float32') 的值太大?” - How to solve the error "value too large for dtype('float32')?" 如何将“对象”的dtype更改为float32? - How to change the dtype of an “object” to float32?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM