public void CustomDimensionsAreSameAsHintWhenCountMatches()
        {
            TensorDimensions dims;
            bool             didApply = CustomDimensionsHint.Parse("2, 3, 5").TryToApply(new TensorDimensions(30), out dims);

            Assert.Equal(new TensorDimensions(2, 3, 5), dims);
            Assert.True(didApply);
        }
Beispiel #2
0
        public void ApplyWithoutErrorMessage()
        {
            string errorMessage;
            var    resultDims = CustomDimensionsHint.Parse("3, 2").TryToApply(new TensorDimensions(6), out errorMessage);

            Assert.Equal(new TensorDimensions(3, 2), resultDims);
            Assert.Equal(string.Empty, errorMessage);
        }
        public void ParsingAndFlaggingTheory(
            string source, CustomDimensionsHint expectedHint, bool isEmpty, bool isFullyDefined)
        {
            var hint = CustomDimensionsHint.Parse(source);

            Assert.True(hint.Equals(expectedHint));
            Assert.Equal(isEmpty, hint.IsEmpty);
            Assert.Equal(isFullyDefined, hint.IsFullyDefined);
        }
        public void WildcardDimensionIsCorrectlyComputed()
        {
            TensorDimensions dims = CustomDimensionsHint.Parse("2, *, 3").TryToApply(new TensorDimensions(30));

            Assert.Equal(dims, new TensorDimensions(2, 5, 3));
        }
 public void ElementCountWorksForWildcardHints()
 {
     Assert.Equal(6, CustomDimensionsHint.Parse("2, *, 3").ElementCount);
 }
 public void ParsingErrorsTheory(string source)
 {
     Assert.Throws <InvalidDimensionsException>(() => { var hint = CustomDimensionsHint.Parse(source); });
 }
        public void ParsesSimpleDimensions()
        {
            var dimensionsHint = CustomDimensionsHint.Parse("2, 3, 5");

            Assert.Equal(new CustomDimensionsHint(2, 3, 5), dimensionsHint);
        }