From 1819cd9422fea8d97fb44fec561087d64089cc51 Mon Sep 17 00:00:00 2001 From: Kalle Westerling Date: Mon, 2 Oct 2023 17:02:16 +0100 Subject: [PATCH] Fixing imports --- deepsensor/data/task.py | 4 ++-- deepsensor/model/convnp.py | 18 ++++++++---------- deepsensor/model/nps.py | 2 +- deepsensor/tensorflow/__init__.py | 4 ++-- deepsensor/torch/__init__.py | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/deepsensor/data/task.py b/deepsensor/data/task.py index df3c6780..031944d0 100644 --- a/deepsensor/data/task.py +++ b/deepsensor/data/task.py @@ -6,8 +6,8 @@ import plum import copy -from deepsensor import backend -from deepsensor.errors import TaskSetIndexError, GriddedDataError +from . import backend +from ..errors import TaskSetIndexError, GriddedDataError class Task(dict): diff --git a/deepsensor/model/convnp.py b/deepsensor/model/convnp.py index a710b767..10facc85 100644 --- a/deepsensor/model/convnp.py +++ b/deepsensor/model/convnp.py @@ -1,9 +1,8 @@ import copy import os.path import json -from typing import Union, List, Literal, Tuple, Optional, types +from typing import Union, List, Literal, Optional import warnings -from typing import Union, List import lab as B import numpy as np @@ -11,23 +10,22 @@ from matrix import Diagonal from plum import ModuleType, dispatch -import deepsensor.data.task -from deepsensor import backend -from deepsensor.data.loader import TaskLoader -from deepsensor.data.processor import DataProcessor -from deepsensor.data.task import ( +from .. import backend +from ..data.loader import TaskLoader +from ..data.processor import DataProcessor +from ..data.task import ( Task, flatten_gridded_data_in_task, flatten_X, flatten_Y, ) -from deepsensor.model.defaults import ( +from ..model.defaults import ( gen_ppu, gen_encoder_scales, gen_decoder_scale, ) -from deepsensor.model.model import DeepSensorModel -from deepsensor.model.nps import ( +from ..model.model import DeepSensorModel +from ..model.nps import ( construct_neural_process, convert_task_to_nps_args, run_nps_model, diff --git a/deepsensor/model/nps.py b/deepsensor/model/nps.py index 25950a94..2fb993e8 100644 --- a/deepsensor/model/nps.py +++ b/deepsensor/model/nps.py @@ -1,4 +1,4 @@ -from deepsensor import backend +from .. import backend import lab as B from deepsensor.data.task import Task diff --git a/deepsensor/tensorflow/__init__.py b/deepsensor/tensorflow/__init__.py index db1d866f..02c8c976 100644 --- a/deepsensor/tensorflow/__init__.py +++ b/deepsensor/tensorflow/__init__.py @@ -20,8 +20,8 @@ def convert_to_tensor(arr): return tf.convert_to_tensor(arr) -from deepsensor import config as deepsensor_config -from deepsensor import backend +from .. import config as deepsensor_config +from .. import backend backend.nps = nps backend.model = tf.keras.Model diff --git a/deepsensor/torch/__init__.py b/deepsensor/torch/__init__.py index 833425bb..ad67015c 100644 --- a/deepsensor/torch/__init__.py +++ b/deepsensor/torch/__init__.py @@ -20,8 +20,8 @@ def convert_to_tensor(arr): return torch.tensor(arr) -from deepsensor import config as deepsensor_config -from deepsensor import backend +from .. import config as deepsensor_config +from .. import backend backend.nps = nps backend.model = torch.nn.Module