Skip to content

Commit 2bc423e

Browse files
committed
remove some on_graph things
1 parent aab846d commit 2bc423e

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

R/dag_class.R

-44
Original file line numberDiff line numberDiff line change
@@ -76,34 +76,6 @@ dag_class <- R6Class(
7676
self$tf_environment$hybrid_data_list <- list()
7777
},
7878

79-
# TF1/2 check remove on_graph
80-
# built with TF
81-
# Not sure if we need this anyore since this information will be handled
82-
# by tf_function?
83-
# execute an expression on this dag's tensorflow graph, with the correct
84-
# float type
85-
on_graph = function(expr) {
86-
# temporarily pass float type info to options, so it can be accessed by
87-
# nodes on definition, without cluncky explicit passing
88-
old_float_type <- options()$greta_tf_float
89-
old_batch_size <- options()$greta_batch_size
90-
91-
on.exit(options(
92-
greta_tf_float = old_float_type,
93-
greta_batch_size = old_batch_size
94-
))
95-
96-
options(
97-
greta_tf_float = self$tf_float,
98-
greta_batch_size = self$tf_environment$batch_size
99-
)
100-
101-
# A tf.Graph can be constructed and used directly without a tf.function,
102-
# as was required in TensorFlow 1, but this is deprecated and it is
103-
# recommended to use a tf.function instead.
104-
with(self$tf_graph$as_default(), expr)
105-
},
106-
10779
# return a list of nodes connected to those in the target node list
10880
build_dag = function(greta_array_list) {
10981
target_node_list <- lapply(greta_array_list, get_node)
@@ -280,21 +252,6 @@ dag_class <- R6Class(
280252
)
281253
} else {
282254
shape <- shape(NULL, length(vals))
283-
# TF1/2 check?
284-
# this `on_graph` part below is probably not needed/wont work because it
285-
# is using placeholder and co?
286-
#
287-
# defining an empty/unknown thing
288-
# so in TF2, we might not need to define a free state, we can
289-
# define a function that returns these pieces of information
290-
# so we will need to define the function relative to the free state
291-
# and will not need to define the object
292-
# Can we just turn this into a tensor with some arbitrary value?
293-
self$on_graph(free_state <- tf$compat$v1$placeholder(
294-
dtype = tf_float(),
295-
shape = shape
296-
))
297-
298255
# TF1/2 check
299256
# instead?
300257
# free_state <- tensorflow::as_tensor(
@@ -320,7 +277,6 @@ dag_class <- R6Class(
320277
lengths <- lengths(params)
321278

322279
if (length(lengths) > 1) {
323-
# args <- self$on_graph(tf$split(free_state, lengths, axis = 1L))
324280
args <- tf$split(free_state, lengths, axis = 1L)
325281
} else {
326282
args <- list(free_state)

0 commit comments

Comments
 (0)