Skip to content

Commit d64ff57

Browse files
committed
Fix latent squeezing
1 parent 6e1ac23 commit d64ff57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/reward_preprocessing/interpret.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ def param_f():
290290
)
291291
# Now, we put the latent vector thru the generator to produce transition
292292
# tensors that we can get observations, actions, etc out of
293-
opt_latent = np.squeeze(opt_latent)
293+
squeeze_shape = [opt_latent.shape[0], opt_latent.shape[3]]
294+
opt_latent = opt_latent.reshape(squeeze_shape)
295+
# ^ squeeze out extraneous "height" and "width" dimensions
294296
opt_latent_th = th.from_numpy(opt_latent).to(th.device(device))
295297
opt_transitions = gan.generator(opt_latent_th)
296298
obs, acts, next_obs = tensor_to_transition(opt_transitions)

0 commit comments

Comments
 (0)