private static void CheckWithException(Tensor[] tensors) { if (tensors.Length != 2) { throw new ArgumentException("Wrong number of arguments."); } if (!TensorUtils.IsScalar(tensors)) { throw new ArgumentException("Non scalar power parametres."); } if (tensors.Any(t => t == null)) { throw new NullReferenceException(); } }
public void Put(Tensor tensor) { if (tensor == null) { throw new ArgumentNullException(nameof(tensor)); } if (!TensorUtils.IsScalar(tensor)) { throw new ArgumentException("Non-scalar tensor on input of Power builder."); } if (Argument is null) { Argument = tensor; return; } if (Power is null) { Power = tensor; return; } throw new InvalidOperationException("Power buider can not take more than two put() invocations."); }