diff src/LazyTensors/lazy_tensor_operations.jl @ 1012:2c1a0722ddb9 feature/lazy_tensors/pretty_printing

Add pretty printing for inflated tensor
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 21 Mar 2022 09:07:28 +0100
parents f7a718bcb4da
children 67969bd7e642
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl	Mon Mar 21 08:55:54 2022 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Mon Mar 21 09:07:28 2022 +0100
@@ -214,6 +214,15 @@
     return apply_transpose(itm.tm, v_inner, inner_index...)
 end
 
+function Base.show(io::IO, ::MIME"text/plain", tm::InflatedLazyTensor{T}) where T
+    show(IOContext(io, :compact=>true), MIME("text/plain"), tm.before)
+    print(io, "⊗")
+    # if get(io, :compact, false)
+    show(io, MIME("text/plain"), tm.tm)
+    print(io, "⊗")
+    show(IOContext(io, :compact=>true), MIME("text/plain"), tm.after)
+end
+
 
 @doc raw"""
     LazyOuterProduct(tms...)