Comments (3)
Hey @lesjie-wen , I am not able to understand your query. Can you provide code snippets where are you getting errors? The snippet you have provided is absolutely fine and works as expected. Please elaborate when l set the output shape to [100, 70] which is the original shape l want
this statement.
from pytorch.
Sorry, there is a mistake, what l want to say is as follows, when l initialized input with the shape of [16,70], error comes:
import torch
linear1 = torch.nn.Linear(in_features=70, out_features=100, bias=False)
custom_weights = torch.ones((56, 90))
linear1.weight = torch.nn.Parameter(custom_weights)
print(linear1.weight.shape)
# torch.Size([56, 90])
input = torch.ones((16, 70))
output = linear1(input)
Traceback (most recent call last):
File "/Users/lesjie/PycharmProjects/test/test.py", line 10, in <module>
output = linear1(input)
File "/Users/lesjie/anaconda3/envs/vima/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/Users/lesjie/anaconda3/envs/vima/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (16x70 and 90x56)
The original shape of input tensor is [N, 70] due to the in_features=70
from pytorch.
inear1.weight = torch.nn.Parameter(custom_weights)
You are changing the weight matrix of the linear layer over here so the weight of linear1 is no longer [N,70]. It's [56,90] that won't allow multiplication by [16,70].
from pytorch.
Related Issues (20)
- torch.ao.nn.quantized.Conv2d get error result in some intel cpu HOT 2
- Summary of tests in machine readable format HOT 7
- torch.roll converts nn.Parameter into regular torch.Tensor HOT 3
- [Dynamo] TypeError: tvm() got an unexpected keyword argument 'options'
- Do we need an N-dim sub-DeviceMesh? HOT 2
- Wrong formula for log_prob in Normal distribution (I was wrong, sry ))
- `torch.set_default_device` does not change `torch.Tensor().device` HOT 1
- [Inductor] Masked `tl.load` operations should explicitly include `other` if the masked out values are expected to be used HOT 3
- Inductor: Codegen for sympy Trunc is incorrect
- Dynamo benchmarks direct arg passing doesn't work HOT 4
- ncclCommWatchdog always terminates the process and prevents error handling if CUDA context is corrupted HOT 1
- torch compiler bisect tool
- [AOTI][UX] One has no way of knowing whether they need to load DSO as CPU or CUDA runner HOT 1
- 2D TP+FSDP with device mesh HOT 1
- Error: Exporting the operator 'aten::searchsorted' to ONNX opset version 17
- [RFC] Deprecation support for Amazon Linux 2 support for PyTorch Release 2.5 HOT 1
- log shapes + dtypes in Flight Recorder logs
- `torch.compiler.allow_in_graph` does not create a `call_module` op in fx.Graph in torch 2.3.0
- codegen error on .item() as a Triton kernel arg
- RuntimeError when using Adam(fused=True) with torch.compile HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch.