static public TensorShape Reduce(this TensorShape shape, int axis) { axis = shape.Axis(axis); var newShapeArray = shape.ToArray(); newShapeArray[axis] = 1; return(new TensorShape(newShapeArray)); }
/// <summary> /// Allow to use negative axis to access tensorShape backward. /// `axis` should be from -rank to rank (exclusive). /// </summary> public int Axis(int axis) { return(shape.Axis(axis)); }