Skip to content

Commit

Permalink
feat(deeplearn): measure prediction performance
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Feb 21, 2025
1 parent d432838 commit e445ca9
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import net.minecraft.entity.Entity
import net.minecraft.entity.LivingEntity
import net.minecraft.util.math.Vec3d
import kotlin.math.min
import kotlin.time.DurationUnit
import kotlin.time.measureTimedValue

/**
* Record using
Expand Down Expand Up @@ -131,9 +133,12 @@ class MinaraiSmoothMode(override val parent: ChoiceConfigurable<*>) : AngleSmoot
age = min(MAXIMUM_TRAINING_AGE, RotationManager.ticksSinceChange)
)

val output = model.predictor.predict(input.asInput)
val (output, time) = measureTimedValue {
model.predictor.predict(input.asInput)
}
ModuleDebug.debugParameter(this, "Output [0]", output[0])
ModuleDebug.debugParameter(this, "Output [1]", output[1])
ModuleDebug.debugParameter(this, "Time", "${time.toString(DurationUnit.MILLISECONDS, 2)} ms")

val modelOutput = Rotation(
currentRotation.yaw + output[0] * outputMultiplier.yawMultiplier,
Expand Down

0 comments on commit e445ca9

Please sign in to comment.