def choice(random_state, size=None, a=2, replace=True, p=None, ndim=None, dtype='int64'):
 a = tensor.as_tensor_variable(a)
 if isinstance(replace, bool):
  replace = tensor.constant(replace, dtype='int8')
 else:
  replace = tensor.as_tensor_variable(replace)
 p = tensor.as_tensor_variable((p or []))
 (ndim, size, bcast) = _infer_ndim_bcast(ndim, size)
 op = RandomFunction(choice_helper, tensor.TensorType(dtype=dtype, broadcastable=bcast))
 return op(random_state, size, a, replace, p)

def choice ( random_state , size = None , a = 2 , replace = True , p = None , ndim = None , dtype = 'int64' ) : a = tensor . as_tensor_variable ( a ) if isinstance ( replace , bool ) : replace = tensor . constant ( replace , dtype = 'int8' ) else : replace = tensor . as_tensor_variable ( replace ) p = tensor . as_tensor_variable ( ( p or [ ] ) ) ( ndim , size , bcast ) = _infer_ndim_bcast ( ndim , size ) op = RandomFunction ( choice_helper , tensor . TensorType ( dtype = dtype , broadcastable = bcast ) ) return op ( random_state , size , a , replace , p )
choose values from a with or without replacement .