private static MyMemoryBlock<float> GetMemBlockWithCustomDims(string dimensionsSource) { var customDims = new TensorDimensions(); customDims.Parse(dimensionsSource); return new MyMemoryBlock<float> { Dims = customDims }; }
public void ParseDoesNotAutoAddDimWhenSizeMatches() { var dims = new TensorDimensions() { Size = 2*2*2 }; dims.Parse("2, 2, 2"); Assert.Equal(3, dims.Count); Assert.Equal(2, dims[0]); Assert.Equal(2, dims[1]); }
public void ParseKeepsDimensionsOfSizeOne() { var dims = new TensorDimensions(); dims.Parse("1, 5, *, 1, 1"); Assert.Equal(5, dims.Count); Assert.Equal(1, dims[0]); Assert.Equal(5, dims[1]); Assert.Equal(1, dims[4]); Assert.Equal("", dims.LastSetWarning); }
public void ParseAutoAddsLeadingDim() { var dims = new TensorDimensions(); dims.Parse("2, 2, 2"); Assert.Equal(4, dims.Count); Assert.Equal(-1, dims[0]); Assert.Equal(2, dims[1]); }