public void CanContructContractionOperation() { var(x, ypred, yactual, yerror, yloss) = new Vector(5, out Index i).Five("x", "ypred", "yactual", "yerror", "yloss"); var(a, b) = new Scalar().Two("a", "b"); ypred.def = a * x + b; Assert.Equal(3, ypred.ElementwiseDefinition.TensorReferences.Count); yerror.def = SQUARE[yactual - ypred]; Assert.Equal(4, yerror.ElementwiseDefinition.TensorReferences.Count); yloss[i, i / 2] = SUM[yerror[i]]; Assert.True(yloss.IsDefined); TensorContraction c = yloss.ContractionDefinition.Expression; Assert.True(c.TensorReferences.Single() == yerror); }
public StructureOfContractionsHashed(TensorContraction freeContraction, params TensorContraction[] contractions) { FreeContraction = freeContraction; Contractions = contractions; }