border_core/
dummy.rs

1//! This module is used for tests.
2#[derive(Clone, Debug)]
3
4/// Dummy observation.
5pub struct DummyObs;
6
7impl crate::Obs for DummyObs {
8    fn len(&self) -> usize {
9        unimplemented!();
10    }
11}
12
13// TODO: Consider to make this work with feature flag tch.
14// impl Into<tch::Tensor> for DummyObs {
15//     fn into(self) -> tch::Tensor {
16//         unimplemented!();
17//     }
18// }
19
20#[derive(Clone, Debug)]
21/// Dummy action.
22pub struct DummyAct;
23
24impl crate::Act for DummyAct {
25    fn len(&self) -> usize {
26        unimplemented!();
27    }
28}
29
30// TODO: Consider to make this work with feature flag tch.
31// impl Into<tch::Tensor> for DummyAct {
32//     fn into(self) -> tch::Tensor {
33//         unimplemented!();
34//     }
35// }
36
37// TODO: Consider to make this work with feature flag tch.
38// impl From<tch::Tensor> for DummyAct {
39//     fn from(_value: tch::Tensor) -> Self {
40//         unimplemented!();
41//     }
42// }
43
44#[derive(Clone)]
45/// Dummy inner batch.
46pub struct DummyInnerBatch;
47
48// TODO: Consider to make this work with feature flag tch.
49// impl Into<tch::Tensor> for DummyInnerBatch {
50//     fn into(self) -> tch::Tensor {
51//         unimplemented!();
52//     }
53// }
54
55/// Dummy batch.
56pub struct DummyBatch;
57
58impl crate::TransitionBatch for DummyBatch {
59    type ObsBatch = DummyInnerBatch;
60    type ActBatch = DummyInnerBatch;
61
62    fn len(&self) -> usize {
63        unimplemented!();
64    }
65
66    fn obs(&self) -> &Self::ObsBatch {
67        unimplemented!();
68    }
69
70    fn act(&self) -> &Self::ActBatch {
71        unimplemented!();
72    }
73
74    fn unpack(
75        self,
76    ) -> (
77        Self::ObsBatch,
78        Self::ActBatch,
79        Self::ObsBatch,
80        Vec<f32>,
81        Vec<i8>,
82        Vec<i8>,
83        Option<Vec<usize>>,
84        Option<Vec<f32>>,
85    ) {
86        unimplemented!();
87    }
88}
89
90/// Dummy replay buffer.
91pub struct DummyReplayBuffer;
92
93impl crate::ReplayBufferBase for DummyReplayBuffer {
94    type Batch = DummyBatch;
95    type Config = usize;
96
97    fn batch(&mut self, _size: usize) -> anyhow::Result<Self::Batch> {
98        unimplemented!();
99    }
100
101    fn build(_config: &Self::Config) -> Self {
102        unimplemented!();
103    }
104
105    fn update_priority(&mut self, _ixs: &Option<Vec<usize>>, _td_err: &Option<Vec<f32>>) {
106        unimplemented!();
107    }
108}
109
110#[derive(Clone, Debug)]
111/// Dummy info.
112pub struct DummyInfo;
113
114impl crate::Info for DummyInfo {}
115
116/// Dummy env.
117pub struct DummyEnv;
118
119impl crate::Env for DummyEnv {
120    type Config = usize;
121    type Act = DummyAct;
122    type Obs = DummyObs;
123    type Info = DummyInfo;
124
125    fn build(_config: &Self::Config, _seed: i64) -> anyhow::Result<Self>
126    where
127        Self: Sized,
128    {
129        unimplemented!();
130    }
131
132    fn reset(&mut self, _is_done: Option<&Vec<i8>>) -> anyhow::Result<Self::Obs> {
133        unimplemented!();
134    }
135
136    fn reset_with_index(&mut self, _ix: usize) -> anyhow::Result<Self::Obs> {
137        unimplemented!();
138    }
139
140    fn step(&mut self, _a: &Self::Act) -> (crate::Step<Self>, crate::record::Record)
141    where
142        Self: Sized,
143    {
144        unimplemented!();
145    }
146
147    fn step_with_reset(&mut self, _a: &Self::Act) -> (crate::Step<Self>, crate::record::Record)
148    where
149        Self: Sized,
150    {
151        unimplemented!();
152    }
153}