Skip to content

Commit

Permalink
Remove unneccessary Random in EMG example (#156)
Browse files Browse the repository at this point in the history
The EMG hand gestures example uses a Random embedding to encode the
timestamp. However, the paper does not use such embedding and the
timing is encoded by permuting the spatial samples.
  • Loading branch information
Zeldax64 authored Sep 26, 2023
1 parent 2de23fd commit 27ae2da
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions examples/emg_hand_gestures.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ def __init__(self, out_features, timestamps, channels):
super(Encoder, self).__init__()

self.channels = embeddings.Random(channels, out_features)
self.timestamps = embeddings.Random(timestamps, out_features)
self.signals = embeddings.Level(NUM_LEVELS, out_features, high=20)

def forward(self, input: torch.Tensor) -> torch.Tensor:
signal = self.signals(input)
samples = torchhd.bind(signal, self.channels.weight.unsqueeze(0))
samples = torchhd.bind(samples, self.timestamps.weight.unsqueeze(1))

samples = torchhd.multiset(samples)
sample_hv = torchhd.ngrams(samples, n=N_GRAM_SIZE)
Expand Down

0 comments on commit 27ae2da

Please sign in to comment.