title: R Error in py_get_attr_impl(x, name, silent) : AttributeError: module 'tensorflow' has no attribute 'placeholder'
body: <p>I am trying to Implement Auto Encoder Dimension Reduction from Tensorflow in R, in this example:</p>
  <pre><code>library(dimRed)
  library(tensorflow)
  fraud_data &lt;- read.csv(&quot;fraud_data&quot;)
  data_label &lt;- fraud_data[&quot;class&quot;]
  my_formula &lt;- as.formula(&quot;class ~ .&quot;)
  dat &lt;- as.dimRedData(my_formula, fraud_data)
  dimen &lt;- NULL
  dimension_params &lt;- NULL
  dimen &lt;- dimRed::AutoEncoder()
  dimension_params &lt;- dimen@stdpars
  dimension_params$ndim &lt;- 2
  emb &lt;- dimen@fun(fraud_data, dimension_params) 
  dimensional_data &lt;- data.frame(emb@data@data)
  x11()
  plot(x=dimensional_data[,1], y=dimensional_data[,2], col=data_label, main=&quot;Laplacian Eigenmaps Projection&quot;)
  legend(x=legend_pos, legend = unique(data_label), col=unique(data_label), pch=1)
  </code></pre>
  <p>I keep getting <code>AttributeError</code> module 'tensorflow' has no attribute 'placeholder'&quot; as stated in this traceback:</p>
  <pre><code>14. stop(structure(list(message = &quot;AttributeError: module 'tensorflow' has no attribute 'placeholder'&quot;, 
      call = py_get_attr_impl(x, name, silent), cppstack = NULL), class = c(&quot;Rcpp::exception&quot;, 
  &quot;C++Error&quot;, &quot;error&quot;, &quot;condition&quot;))) 
  13. py_get_attr_impl(x, name, silent) 
  12. py_get_attr(x, name) 
  11. py_get_attr_or_item(x, name, TRUE) 
  10. `$.python.builtin.object`(x, name) 
  9. `$.python.builtin.module`(tf, &quot;placeholder&quot;) 
  8. tf$placeholder 
  7. graph_params(d_in = ncol(indata), n_hidden = n_hidden, activation = activation, 
      weight_decay = weight_decay, learning_rate = learning_rate, 
      n_steps = n_steps, ndim = ndim) 
  6. eval(substitute(expr), data, enclos = parent.frame()) 
  5. eval(substitute(expr), data, enclos = parent.frame()) 
  4. with.default(pars, {
      graph_params(d_in = ncol(indata), n_hidden = n_hidden, activation = activation, 
          weight_decay = weight_decay, learning_rate = learning_rate, 
          n_steps = n_steps, ndim = ndim) ... 
  3. with(pars, {
      graph_params(d_in = ncol(indata), n_hidden = n_hidden, activation = activation, 
          weight_decay = weight_decay, learning_rate = learning_rate, 
          n_steps = n_steps, ndim = ndim) ... 
  2. dimen@fun(dat, dimension_params) 
  
  Error in py_get_attr_impl(x, name, silent) : 
    AttributeError: module 'tensorflow' has no attribute 'placeholder' 
  </code></pre>
  <p>As by the common solution is to Disable Tensorflow 2 Behaviour as stated in <a href="https://stackoverflow.com/questions/55142951/tensorflow-2-0-attributeerror-module-tensorflow-has-no-attribute-session">Tensorflow 2.0 - AttributeError: module &#39;tensorflow&#39; has no attribute &#39;Session&#39;</a>, I tried to use reticulate and suppress the errors by this example:</p>
  <pre><code>library(reticulate)
  x &lt;- import(&quot;tensorflow.compat.v1&quot;, as=&quot;tf&quot;) 
  x$disable_v2_behavior()
  </code></pre>
  <p>but this doesn't change anything.. and I still get <code>AttributeError</code>, I am wondering, How should I make a proper change in Tensorflow from R in this case?</p>
  <p>Here is Sample Data used for the example: <a href="https://drive.google.com/file/d/1Yt4V1Ir00fm1vQ9futziWbwjUE9VvYK7/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1Yt4V1Ir00fm1vQ9futziWbwjUE9VvYK7/view?usp=sharing</a></p>