protoShape :: Lens' TensorShapeProto Shape
protoShape = under (adapter protoToShape shapeToProto)
  where
    protoToShape p = fromMaybe (error msg) (view protoMaybeShape p)
      where msg = "Can't convert TensorShapeProto with unknown rank to Shape: "
                  ++ showMessageShort p
    shapeToProto s' = defMessage & protoMaybeShape .~ Just s'
protoShape :: Lens' TensorShapeProto Shape
protoShape = under (adapter protoToShape shapeToProto)
  where
    protoToShape p = fromMaybe (error msg) (view protoMaybeShape p)
      where msg = "Can't convert TensorShapeProto with unknown rank to Shape: "
                  ++ showMessageShort p
    shapeToProto s' = defMessage & protoMaybeShape .~ Just s'
protoShape = under (adapter protoToShape shapeToProto)
  where
    protoToShape p = fromMaybe (error msg) (view protoMaybeShape p)
      where msg = "Can't convert TensorShapeProto with unknown rank to Shape: "
                  ++ showMessageShort p
    shapeToProto s' = defMessage & protoMaybeShape .~ Just s'