randomTensor(withShape:descriptor:seed:name:)
Creates a Random op of type matching distribution in descriptor and returns random values.
Declaration
func randomTensor(withShape shape: [NSNumber], descriptor: MPSGraphRandomOpDescriptor, seed: Int, name: String?) -> MPSGraphTensorParameters
- shape:
The shape of the tensor generated
- descriptor:
The descriptor of the distribution. See MPSGraphRandomOpDescriptor.
- seed:
The seed to use to initialize state. All calls with equal seed yield an identical stream of random values.
- name:
The name for the operation.
Return Value
An MPSGraphTensor of shape containing random values in the defined range.
Discussion
Returns a tensor of provided shape of random values in the distribution specified. Uses the provided seed value to initalize state. No state is preserved, and all calls with equal seed yield an identical stream of random values.