Skip to content
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

mindspore.nn.Conv1d and mindspore.nn.Conv1dtranspose 's shapes are four-dimensional #284

Open
PhyllisJi opened this issue May 19, 2024 · 1 comment

Comments

@PhyllisJi
Copy link

PhyllisJi commented May 19, 2024

Environment

Hardware Environment(Ascend/GPU/CPU):

CPU and GPU

Software Environment:

  • MindSpore version (source or binary): 2.2.14
  • Python version (e.g., Python 3.7.5):3.0
  • OS platform and distribution (e.g., Linux Ubuntu 16.04):Ubuntu 20.04

Describe the current behavior

The parameter shapes of mindspore.nn.Conv1d and mindspore.nn.Conv1dtranspose are four-dimensional, causing the model to be unable to complete the reading of the parameters. The dimensions described in the official documentation are supposed to be three-dimensional, and other frameworks such as TensorFlow and PyTorch are also three-dimensional.

Describe the expected behavior

Their parameter shapes should be one-dimensional

Related log / screenshot

1621716100461_ pic_hd

@VectorSL
Copy link
Contributor

VectorSL commented Sep 9, 2024

你好。确实存在上述差异,MindSpore的Conv1d底层使用Conv2d算子实现,对于 kernel_size 等参数会在第0维进行自动补0操作,导致初始化的权重weight比PyTorch多一维,正常使用不感知,但涉及网络模型迁移时,通过参数加载的方式调用Conv1d可能会出现权重维度不一致的情况,需要用户手动对weight权重在对应维度上进行升维。
详见 conv1d差异faq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants