Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.
Merged
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions Gym/CartPole/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct Episode {

/// Filtering out bad/short episodes before we feed them as neural net training data.
func filteringBatch(
episodes: [Episode],
actionCount: Int
episodes: [Episode],
actionCount: Int
) -> (input: Tensor<Float>, target: Tensor<Float>, episodeCount: Int, meanReward: Float) {
let rewards = episodes.map { $0.reward }
let rewardBound = Float(np.percentile(rewards, percentile))!
Expand Down Expand Up @@ -111,10 +111,10 @@ func filteringBatch(
}

func nextBatch(
env: PythonObject,
net: Net,
batchSize: Int,
actionCount: Int
env: PythonObject,
net: Net,
batchSize: Int,
actionCount: Int
) -> [Episode] {
var observationNumpy = env.reset()

Expand Down