klyn.math.nn.Sequential.to
method
public to(device as Device) as Sequential<T>
Description

Selects execution without resetting parameters, optimizer state or precision. Transfers are performed on demand; selecting CPU makes current weights available on the CPU before the next operation. GPU/NPU mean one device, never implicit multi-device training. NPU execution is reserved for a future release.

Parameters
ParameterDescription
deviceAutomatic policy, CPU, GPU category or concrete GPU.
Returns

This model for chaining.

Throws
  • ValueException for null, unsupported layers or unavailable hardware/NPU.
Example

model.to(Device.gpu[0]); model.fit(xTrain, yTrain)