Explain the pyramid of energy and the pyramid of biomass

Explain the pyramid of energy and the pyramid of biomass. Why the pyramid of biomass can be upright or inverted?