2 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

MLSession

Inherits from: Object

An MLSession wraps a single loaded neural-network model and runs inference on it. You don't construct a session directly; instead, MLService:CreateSessionAsync() loads a model bundle for a given asset and returns a ready-to-use session. Call ForwardAsync() on that session to run the model's forward pass on your input data and receive its output.

Inherits from: Object

Memory category: Instances

Tags: NotCreatable, NotReplicated

Methods

NameType / ReturnsDescription
MLSession:ForwardAsyncDictionaryRuns the session's model on the given input and asynchronously returns the model's output.

Inherited from Object

NameType / ReturnsDescription
Object:GetPropertyChangedSignalRBXScriptSignalGet an event that fires when a given property of the object changes.
Object:IsAbooleanReturns true if an object's class matches or inherits from a given class.
Object:isAboolean

MLSession:ForwardAsync

Runs inference for the session's loaded model.

If the model declares a dynamic output dimension, the call errors. Calling this method on a session with no valid loaded model also errors.

Parameters

NameTypeDefaultDescription
dataDictionaryA dictionary mapping each of the model's input names to that input's tensor, given as a nested array of numbers matching the input's shape.

Returns

TypeDescription
DictionaryA dictionary mapping each of the model's output names to that output's tensor, given as a nested array of numbers matching the output's shape.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["Basic"]

Properties

Inherited from Object

NameType / ReturnsDescription
Object.ClassNamestringA read-only string representing the class this Object belongs to.
Object.classNamestring

Events

Inherited from Object

NameType / ReturnsDescription
Object.ChangedFires immediately after a property of the object changes, with some limitations.