@@ -242,9 +242,9 @@ public static Tensor rot90(Tensor image, int k = 1, string name = null)
242242 image = ops . convert_to_tensor ( image , name : "image" ) ;
243243 image = _AssertAtLeast3DImage ( image ) ;
244244
245- // can't get k to convert to tensor without throwing error about it being an int---
246- // might rework later. for now, k2 == k as Tensor
247- Tensor k2 = ops . convert_to_tensor ( k , dtype : dtypes . int32 , name : "k" ) ;
245+ // can't get k to convert to tensor without throwing error about it being an int---
246+ // might rework later. for now, k2 == k as Tensor
247+ Tensor k2 = ops . convert_to_tensor ( k , dtype : dtypes . int32 , name : "k" ) ;
248248 k2 . TensorShape . assert_has_rank ( 0 ) ;
249249 k2 = gen_ops . mod ( k2 , tf . constant ( 4 ) ) ;
250250
@@ -465,8 +465,8 @@ public static Tensor pad_to_bounding_box(Tensor image, int offset_height, int of
465465
466466 var assert_ops = _CheckAtLeast3DImage ( image , require_static : false ) ;
467467
468- // batch: [0], height: [1], width: [2], depth: [3]
469- int [ ] bhwd = _ImageDimensions ( image , rank : 4 ) ;
468+ // batch: [0], height: [1], width: [2], depth: [3]
469+ int [ ] bhwd = _ImageDimensions ( image , rank : 4 ) ;
470470
471471 var after_padding_width = target_width - offset_width - bhwd [ 2 ] ;
472472
@@ -544,8 +544,8 @@ public static Tensor crop_to_bounding_box(Tensor image, int offset_height, int o
544544
545545 var assert_ops = _CheckAtLeast3DImage ( image , require_static : false ) ;
546546
547- // batch: [0], height: [1], width: [2], depth: [3]
548- int [ ] bhwd = _ImageDimensions ( image , rank : 4 ) ;
547+ // batch: [0], height: [1], width: [2], depth: [3]
548+ int [ ] bhwd = _ImageDimensions ( image , rank : 4 ) ;
549549
550550 assert_ops [ assert_ops . Length ] = _assert ( check_ops . assert_greater_equal ( tf . constant ( offset_height ) ,
551551 tf . constant ( 0 ) ) , typeof ( ValueError ) ,
@@ -976,7 +976,7 @@ public static Tensor per_image_standardization(Tensor image)
976976
977977 image = image - image_mean ;
978978 image = tf . div ( image , adjusted_stddev , name : scope ) ; // name: scope in python version
979- return convert_image_dtype ( image , orig_dtype , saturate : true ) ;
979+ return convert_image_dtype ( image , orig_dtype , saturate : true ) ;
980980 } ) ;
981981 }
982982
@@ -1177,9 +1177,9 @@ public static Tensor adjust_jpeg_quality(Tensor image, Tensor jpeg_quality, stri
11771177 image = ops . convert_to_tensor ( image , name : "image" ) ;
11781178 var channels = image . TensorShape . as_list ( ) [ image . TensorShape . dims . Length - 1 ] ;
11791179 var orig_dtype = image . dtype ;
1180- // python code checks to ensure jpeq_quality is a tensor; unnecessary here since
1181- // it is passed as a tensor
1182- image = gen_ops . encode_jpeg_variable_quality ( image , quality : jpeg_quality ) ;
1180+ // python code checks to ensure jpeq_quality is a tensor; unnecessary here since
1181+ // it is passed as a tensor
1182+ image = gen_ops . encode_jpeg_variable_quality ( image , quality : jpeg_quality ) ;
11831183
11841184 image = gen_ops . decode_jpeg ( image , channels : channels ) ;
11851185 return convert_image_dtype ( image , orig_dtype , saturate : true ) ;
@@ -1587,8 +1587,8 @@ Tensor[] do_pad(Tensor[] images, Tensor remainder)
15871587 {
15881588 if ( k > 0 )
15891589 {
1590- // handle flat_imgs
1591- Tensor [ ] flat_imgs = new Tensor [ ] { } ;
1590+ // handle flat_imgs
1591+ Tensor [ ] flat_imgs = new Tensor [ ] { } ;
15921592 foreach ( ( Tensor x , Tensor t ) in imgs . Zip ( tails , Tuple . Create ) )
15931593 {
15941594 flat_imgs [ flat_imgs . Length ] = array_ops . reshape ( x , array_ops . concat ( new Tensor [ ] { constant_op . constant ( - 1 ) , t } , 0 ) ) ;
@@ -1602,42 +1602,42 @@ Tensor[] do_pad(Tensor[] images, Tensor remainder)
16021602 true_fn : ( ) => padded_func_pass ( ) ,
16031603 false_fn : ( ) => flat_imgs ) ;
16041604
1605- // handle downscaled
1606- Tensor [ ] downscaled = new Tensor [ ] { } ;
1605+ // handle downscaled
1606+ Tensor [ ] downscaled = new Tensor [ ] { } ;
16071607 foreach ( Tensor x in padded )
16081608 {
16091609 downscaled [ downscaled . Length ] = gen_ops . avg_pool ( x , ksize : divisor , strides : divisor , padding : "VALID" ) ;
16101610 }
16111611
1612- // handle tails
1613- tails = new Tensor [ ] { } ;
1612+ // handle tails
1613+ tails = new Tensor [ ] { } ;
16141614 foreach ( Tensor x in gen_array_ops . shape_n ( downscaled ) )
16151615 {
16161616 tails [ tails . Length ] = new Tensor ( x . dims . Skip ( 1 ) . Take ( tails . Length - 1 ) . ToArray ( ) ) ;
16171617 }
16181618
16191619 imgs = new Tensor [ ] { } ;
1620- // tuples weren't working; this is hacky, but should work similarly.
1621- // zip loads the values into a tuple (Tensor, Tensor, Tensor) for each
1622- // zip entry; this just gets the length of the longest array, and loops
1623- // that many times, getting values (like zip) and using them similarly.
1624- for ( int x = 0 ; x < Math . Max ( Math . Max ( downscaled . Length , heads . Length ) , tails . Length ) ; x ++ )
1620+ // tuples weren't working; this is hacky, but should work similarly.
1621+ // zip loads the values into a tuple (Tensor, Tensor, Tensor) for each
1622+ // zip entry; this just gets the length of the longest array, and loops
1623+ // that many times, getting values (like zip) and using them similarly.
1624+ for ( int x = 0 ; x < Math . Max ( Math . Max ( downscaled . Length , heads . Length ) , tails . Length ) ; x ++ )
16251625 {
16261626 imgs [ imgs . Length ] = array_ops . reshape ( downscaled [ x ] , array_ops . concat ( new Tensor [ ] { heads [ x ] , tails [ x ] } , 0 ) ) ;
16271627 }
16281628 }
16291629 }
16301630
1631- // python code uses * to unpack imgs; how to replicate that here?
1632- // don't think that this is doing the same thing as the python code.
1633- ( ssim_per_channel , cs ) = _ssim_per_channel (
1634- img1 : imgs [ 0 ] ,
1635- img2 : imgs [ 1 ] ,
1636- max_val : max_val ,
1637- filter_size : filter_size ,
1638- filter_sigma : filter_sigma ,
1639- k1 : k1 ,
1640- k2 : k2 ) ;
1631+ // python code uses * to unpack imgs; how to replicate that here?
1632+ // don't think that this is doing the same thing as the python code.
1633+ ( ssim_per_channel , cs ) = _ssim_per_channel (
1634+ img1 : imgs [ 0 ] ,
1635+ img2 : imgs [ 1 ] ,
1636+ max_val : max_val ,
1637+ filter_size : filter_size ,
1638+ filter_sigma : filter_sigma ,
1639+ k1 : k1 ,
1640+ k2 : k2 ) ;
16411641 mcs . append ( gen_nn_ops . relu ( cs ) ) ;
16421642 }
16431643
0 commit comments