This repository was archived by the owner on Jul 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -687,26 +687,24 @@ extension LazyTensor: CustomStringConvertible {
687
687
688
688
extension LazyTensorOperation : CustomStringConvertible {
689
689
public var description : String {
690
- let attrsDesc = attrs. map { ( name , value ) in " \( name ) : \( value ) " }
691
- let inputsDesc = inputs. map { ( input: Input ) -> String in
690
+ let attrsDesc = attrs. sorted ( by : { $0 . key < $1 . key } ) . map { " \( $0 ) : \( $1 ) " }
691
+ let inputsDesc = inputs. map { input -> String in
692
692
switch input {
693
693
case Input . single( let lazyTensor) :
694
694
return " \( lazyTensor) "
695
695
case Input . list( let lazyTensorList) :
696
- do {
697
- let lazyTensors = lazyTensorList. map { " \( $0) " }
698
- let lazyTensorsDesc = lazyTensors. joined ( separator: " , " )
699
- return " [ \( lazyTensorsDesc) ] "
700
- }
696
+ let lazyTensors = lazyTensorList. map { " \( $0) " }
697
+ let lazyTensorsDesc = lazyTensors. joined ( separator: " , " )
698
+ return " [ \( lazyTensorsDesc) ] "
701
699
}
702
700
}
703
701
var desc = " \( outputName) = \( name) "
704
- if attrs. count > 0 {
702
+ if ! attrs. isEmpty {
705
703
desc += " [ "
706
704
desc += attrsDesc. joined ( separator: " , " )
707
705
desc += " ] "
708
706
}
709
- desc += " ( "
707
+ desc += " ( "
710
708
desc += inputsDesc. joined ( separator: " , " )
711
709
desc += " ) "
712
710
return desc
Original file line number Diff line number Diff line change @@ -166,10 +166,7 @@ final class LazyTensorOperationTests: XCTestCase {
166
166
_id: " 0 " , name: " Nop " , outputCount: 1 )
167
167
op0. updateAttribute ( " b " , true )
168
168
op0. updateAttribute ( " s " , " hello " )
169
- XCTAssert (
170
- ( op0. description == " %0 = Nop[b: true, s: \" hello \" ]() " ) ||
171
- ( op0. description == " %0 = Nop[s: \" hello \" , b: true]() " )
172
- )
169
+ XCTAssertEqual ( op0. description, " %0 = Nop[b: true, s: \" hello \" ]() " )
173
170
}
174
171
175
172
func testFunctionAttribute( ) {
You can’t perform that action at this time.
0 commit comments