TensorUtils
public class TensorUtils
Undocumented
-
Randomlly generate a
Tensor
object.Declaration
Swift
public static func generateRandomTensor(targetTensorShape shape: TensorShape, maxVal: Float) -> Tensor
-
For a
swift
n-d array, flat it into a 1-d array.array: The given raw array data. We don’t preassume it’s shape.
Note
The returned array could be empty if all elements of the passed in array are not supported types.
Declaration
Swift
public static func flattenArray(array: [Any], dataType type: TensorDataType) -> [Float]
Return Value
An array of
SupportedTensorInitialDataType
elements. It could be empty.