/// Seed all backends with the given random seed, or a new seed based on the current time
/// if no seed is specified.
static memberSeed(?seed:int)=
letseed= defaultArg seed (int DateTime.Now.Ticks)
Random.Seed(seed)// Do not remove. util.Random seed would be set by the Reference backend if it's currently loaded. However we still need to keep this here to ensure util.Random seed is set (it may be used in code other than the Reference backend).
for KeyValue(_, backend)in hook.Backends do
backend.Seed(seed)
/// Create a tensor of appropriate dtype from a scalar or array of appropriate values.
/// A backend type is delivered consistent with in-memory data - a type for dtype Int32 gets int32 data etc.