Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

einsum() operands do not broadcast with remapped shapes #17

Open
immusferr opened this issue Sep 26, 2022 · 4 comments
Open

einsum() operands do not broadcast with remapped shapes #17

immusferr opened this issue Sep 26, 2022 · 4 comments

Comments

@immusferr
Copy link

Hi, Gerald.
I am trying to running your code on my own dataset. But I got some problems here:

RuntimeError: einsum() operands do not broadcast with remapped shapes [original->remapped]: [32, 37, 320]->[32, 37, 1, 320] [101, 320, 160]->[1, 101, 160, 320]

@gorold
Copy link
Contributor

gorold commented Sep 26, 2022

Hey, thanks for your interest in our work, could you provide more information on this error (the full error log) and the dimensions of the data you are working with? I can't really tell whats wrong from just this error message.

@yyyujintang
Copy link

yyyujintang commented Nov 10, 2022

I met the same problem.
`
import torch

from torch import nn

import torchinfo

from torchinfo import summary

net = CoSTEncoder(
input_dims=12, output_dims=3,
kernels=[1, 2, 4, 8, 16, 32, 64, 128],
length=3000,
hidden_dims=64, depth=10,
)

summary(net,input_size=(1,121,12),col_names=["kernel_size","output_size","num_params","mult_adds"])
`
And I get the error einsum(): operands do not broadcast with remapped shapes [original->remapped]: [1, 61, 3]->[1, 61, 1, 3] [1501, 3, 1]->[1, 1501, 1, 3]

@yyyujintang
Copy link

I figure out the problem, the length in CoSTEncoder must match your dataset.
For example, my length is 121, then change it in the Enocder part.
`
import torch

from torch import nn

import torchinfo

from torchinfo import summary

net = CoSTEncoder(
input_dims=12, output_dims=3,
kernels=[1, 2, 4, 8, 16, 32, 64, 128],
length=121,
hidden_dims=64, depth=10,
)
`
summary(net,input_size=(1,121,12),col_names=["kernel_size","output_size","num_params","mult_adds"])

@17103023
Copy link

My dataset is similar to yours, with a total of 8 columns and 1681 rows, and the runtime reports such an error

Traceback (most recent call last):
File "train.py", line 109, in
out, eval_res = tasks.eval_forecasting(model, data, train_slice, valid_slice, test_slice, scaler, pred_lens, n_covariate_cols, args.max_train_length-1)
File "/userdata/lwy/CoST-main/tasks/forecasting.py", line 55, in eval_forecasting
lr = eval_protocols.fit_ridge(train_features, train_labels, valid_features, valid_labels)
File "/userdata/lwy/CoST-main/tasks/_eval_protocols.py", line 25, in fit_ridge
lr = Ridge(alpha=alpha).fit(train_features, train_y)
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/linear_model/_ridge.py", line 762, in fit
return super().fit(X, y, sample_weight=sample_weight)
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/linear_model/_ridge.py", line 542, in fit
X, y = self._validate_data(X, y,
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/base.py", line 433, in _validate_data
X, y = check_X_y(X, y, **check_params)
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 814, in check_X_y
X = check_array(X, accept_sparse=accept_sparse,
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "/userdata/lwy/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 669, in check_array
raise ValueError("Found array with %d sample(s) (shape=%s) while a"
ValueError: Found array with 0 sample(s) (shape=(0, 320)) while a minimum of 1 is required.

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

4 participants