@@ -16,7 +16,7 @@ public class _FetchHandler<T>
1616 private List < Tensor > _final_fetches = new List < Tensor > ( ) ;
1717 private List < T > _targets = new List < T > ( ) ;
1818
19- public _FetchHandler ( Graph graph , T fetches , Dictionary < Tensor , NDArray > feeds = null , object feed_handles = null )
19+ public _FetchHandler ( Graph graph , T fetches , Dictionary < Tensor , NDArray > feeds = null , Action feed_handles = null )
2020 {
2121 _fetch_mapper = new _FetchMapper < T > ( ) . for_fetch ( fetches ) ;
2222 foreach ( var fetch in _fetch_mapper . unique_fetches ( ) )
@@ -40,18 +40,32 @@ public _FetchHandler(Graph graph, T fetches, Dictionary<Tensor, NDArray> feeds =
4040 _final_fetches = _fetches ;
4141 }
4242
43- public NDArray build_results ( Session session , NDArray [ ] tensor_values )
43+ public NDArray build_results ( BaseSession session , NDArray [ ] tensor_values )
4444 {
4545 var full_values = new List < object > ( ) ;
46+ if ( _final_fetches . Count != tensor_values . Length )
47+ throw new InvalidOperationException ( "_final_fetches mismatch tensor_values" ) ;
4648
49+ int i = 0 ;
50+ int j = 0 ;
4751 foreach ( var is_op in _ops )
4852 {
4953 if ( is_op )
5054 {
5155 full_values . Add ( null ) ;
5256 }
57+ else
58+ {
59+ var value = tensor_values [ j ] ;
60+ j += 1 ;
61+ full_values . Add ( value ) ;
62+ }
63+ i += 1 ;
5364 }
5465
66+ if ( j != tensor_values . Length )
67+ throw new InvalidOperationException ( "j mismatch tensor_values" ) ;
68+
5569 return _fetch_mapper . build_results ( full_values ) ;
5670 }
5771
0 commit comments