2,922 questions
0
votes
0
answers
20
views
Size Mismatch in MultiModal Feedback Model Using T5 + Audio/Visual Features - The size of tensor a (48) must match the size of tensor b (4) with T5
I’m working on a multimodal model that combines audio and visual features with a T5-based encoder for a feedback generation task. However, I’m facing an issue with batch size mismatch between the ...
-1
votes
0
answers
29
views
Why does introducing dimension interactions via dot product reduce model performance?
I'm training a deep learning model where my original architecture involves an element-wise product between vectors. Specifically, the computation is straightforward:
# Original computation (element-...
0
votes
2
answers
77
views
Why do we reshape key, query, and value tensors in multi-head attention?
In my PyTorch implementation of multi-head attention, i have those in __init__()
class MultiHeadAttentionLayer(nn.Module):
def __init__(self,d_in,d_out,context_length,dropout,num_heads,use_bias=...
0
votes
2
answers
41
views
Why does the square of a complex tensor with no imaginary part yields a result with an imaginary part?
I have a complex tensor: tensor1 = tensor([0.0000+0.j, -106990.0794+0.j], device='cuda:1', dtype=torch.complex128)
The both elements have no imaginary part (0.j), however, when squaring the variable ...
0
votes
1
answer
27
views
Can PyTorch `scatter` or `gather` be used to reproduce `torch_geometric` aggregation functions?
I can't understand if torch.scatter or torch.gather could be used to reduce values of a tensor according to a reduction function over specified indices.
I've frequently used the torch_geometric.nn....
0
votes
0
answers
11
views
Adding together results from multiple workers with ignite
I'm trying to figure out if ignite is a good fit for my application.
I have a large collection of records which will be processed by multiple workers running in separate processes.
Each worker will ...
1
vote
1
answer
39
views
How to produce tensor of first occurrencies of another tensor using PyTorch
Let's say we have an ordered 1D tensor of ints/longs t.
I want to produce a new tensor a with size max(t) where each term a[i] contains the first occurrence of the value i in the tensor t.
We could ...
4
votes
2
answers
83
views
Identifying and removing duplicate columns/rows in sparse binary matrix in PyTorch
Let's suppose we have a binary matrix A with shape n x m,
I want to identify rows that have duplicates in the matrix, i.e. there is another index on the same dimension with the same elements in the ...
-1
votes
1
answer
121
views
How to solve RuntimeError: Tensors must have same number of dimensions: got 2 and 3?
i am trying to run newly announced model: Phi-4-mini-instruct
https://huggingface.co/microsoft/Phi-4-mini-instruct
It has example, I tried it on Google Colab T4 Notebook, but here is what I got
import ...
1
vote
2
answers
73
views
Calling Multiple Functions on Multiple Rows of a Tensor in Parallel
import torch
x = torch.ones(3, 3)
factors = [lambda x: 2*x, lambda x: 3*x, lambda x: 4*x]
indices = torch.tensor([0, 1, 2])
def multiply_row_by_factor(row, idx):
return factors[idx](row)
...
3
votes
1
answer
48
views
Pytorch 'smaller than' operation on tensor gives wrong result
I get a very weird behavior for a 'smaller' operation on a float torch tensor.
Consider the following snippet
t = torch.load(r"value.pt")
print(t.shape, t.dtype)
#t = t.double()
for i in ...
1
vote
1
answer
46
views
Map each element of torch.Tensor with it's value in the dict
Suppose i have a tensor t consisting only zeros and ones:
t = torch.Tensor([1, 0, 0, 1])
And a dict with the weights:
weights = {0: 0.1, 1: 0.9}
I want to form a new tensor new_t, such that every ...
2
votes
1
answer
78
views
How to map values from a 3D tensor to a 1D tensor in PyTorch?
I'm stuck with a Pytorch problem and could use some help:
I've got two tensors:
A 3D tensor (shape: i, j, j) with integer values from 0 to n
A 1D tensor (shape: n)
I need to create a new tensor that'...
0
votes
0
answers
48
views
How can I get more images after augmenting each image?
I'm new to tensorflow. I want to generate more images after image augmentation but images and labels are (10, None, 400, 400, 3) and (10, None, 1) respectively and I guess it artifically count as 1 ...
1
vote
1
answer
49
views
How to add density plots for x and z axes in a tensor smooth plot?
I created this plot using tensor smooths..
I would like to add a visualization of the data density along the x-axis and z-axis. Ideally, this could be done with either:
A rug plot on the respective ...