[X] I have searched the Issue Tracker that this hasn't already been reported. (comment there if it has.)
What version of ASTRA are you using?
0.1.dev26
What Python version are you using?
3.11.4
Problem description
I encountered an issue while working with a different strategy. The issue is related to a ValueError that occurs when using a specific configuration. This issue seems to be straightforward to resolve.
The issue arises when there are two variables, but if only one variable is provided, it leads to a problem with the shapes. The line of code causing the issue is:
I expect to be able to import the strategy and run it without encountering errors. This code should work seamlessly with different strategies, and I should be able to pass the necessary variables without shape-related problems.
I'm reaching out for insights into why this behavior is occurring. More importantly, I'm seeking guidance on how to effectively address this issue. Your assistance in unraveling this conundrum would be immensely appreciated.
Reproducible example code
The Python snippets:
import torch
import torch.nn as nn
import numpy as np
from astra.torch.al import DeterministicStrategy, EntropyAcquisition
# Mock data: Replace this with your actual data
inputs = torch.tensor(np.random.rand(100, 2), dtype=torch.float32)
outputs = torch.randint(0, 2, (100,), dtype=torch.long)
# Create a simple neural network model
class SimpleNet(nn.Module):
def __init__(self):
super(SimpleNet, self).__init__()
self.fc = nn.Linear(2, 2)
def forward(self, x):
return self.fc(x)
# Create an instance of your EntropyAcquisition
entropy_acquisition = EntropyAcquisition()
# Create a DeterministicStrategy instance with the EntropyAcquisition
strategy = DeterministicStrategy(entropy_acquisition, inputs, outputs)
# Define the pool of unlabeled data
pool_indices = torch.arange(100)
# Define a neural network model
net = SimpleNet()
# Use the strategy to query for samples
n_query_samples = 5
best_indices = strategy.query(net, pool_indices, n_query_samples=n_query_samples)
print("Best indices:", best_indices)
Required prerequisites
What version of ASTRA are you using?
0.1.dev26
What Python version are you using?
3.11.4
Problem description
I encountered an issue while working with a different strategy. The issue is related to a ValueError that occurs when using a specific configuration. This issue seems to be straightforward to resolve.
The issue arises when there are two variables, but if only one variable is provided, it leads to a problem with the shapes. The line of code causing the issue is:
I expect to be able to import the strategy and run it without encountering errors. This code should work seamlessly with different strategies, and I should be able to pass the necessary variables without shape-related problems.
I'm reaching out for insights into why this behavior is occurring. More importantly, I'm seeking guidance on how to effectively address this issue. Your assistance in unraveling this conundrum would be immensely appreciated.
Reproducible example code
The Python snippets:
Traceback
No response
Additional context
No response