meshgrid() got multiple values for keyword argument 'indexing'
时间: 2024-05-10 15:20:51 浏览: 222
This error occurs when the `meshgrid()` function is called with multiple values for the `indexing` keyword argument. The `indexing` argument specifies the ordering of the output arrays.
To fix this error, make sure that you are only passing one value for the `indexing` argument. For example, if you want to use 'xy' indexing, use:
```
x, y = np.meshgrid(x_values, y_values, indexing='xy')
```
If you are still getting the error, check that you are not accidentally passing the `indexing` argument twice or that there are no typos in your code.
相关问题
报错meshgrid() got multiple values for keyword argument 'indexing'
这个错误是由于meshgrid()函数中的多个参数指定了关键字参数'indexing',导致函数无法确定如何处理这个参数。解决方法是只指定一个'indexing'参数,或者使用位置参数而不是关键字参数。以下是一个示例:
```python
import numpy as np
x = np.arange(3)
y = np.arange(4)
# 错误示例
xx, yy = np.meshgrid(x, y, indexing='xy', indexing='ij')
# 正确示例1:只指定一个'indexing'参数
xx, yy = np.meshgrid(x, y, indexing='xy')
# 正确示例2:使用位置参数
xx, yy = np.meshgrid(x, y, 'xy')
```
TypeError: torch._VariableFunctionsClass.meshgrid() got multiple values for keyword argument 'indexing'
这个错误可能是由于传递了多个 `indexing` 关键字参数导致的。请检查你的代码,看看是否在函数调用中重复使用了 `indexing` 关键字参数。
另外,如果你正在使用 PyTorch 版本较低的话,也可能会出现此错误,因为旧版本的 PyTorch 可能不支持 `indexing` 关键字参数。你可以尝试升级 PyTorch 到最新版本或者使用其他方式来指定你需要的索引方式。
阅读全文
相关推荐

















