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

removed 'BatchKey' from 'encoders.py' and replaced necessary parts with strings... #329

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pvnet/models/multimodal/site_encoders/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import einops
import torch
from ocf_datapipes.batch import BatchKey

# removed BatchKey import
# from ocf_datapipes.batch import BatchKey
from torch import nn

from pvnet.models.multimodal.linear_networks.networks import ResFCNet2
Expand Down Expand Up @@ -75,13 +77,13 @@ def __init__(
)

def _calculate_attention(self, x):
gsp_ids = x[BatchKey.gsp_id].squeeze().int()
gsp_ids = x["gsp_id"].squeeze().int() # removed BatchKey
attention = self._attention_network(gsp_ids)
return attention

def _encode_value(self, x):
# Shape: [batch size, sequence length, PV site]
pv_site_seqs = x[BatchKey.pv].float()
pv_site_seqs = x["pv"].float() # removed BatchKey
batch_size = pv_site_seqs.shape[0]

pv_site_seqs = pv_site_seqs.swapaxes(1, 2).flatten(0, 1)
Expand Down