Posts

Showing posts with the label Tensorflow

Can I Use TensorBoard With Google Colab?

Answer : EDIT: You probably want to give the official %tensorboard magic a go, available from TensorFlow 1.13 onward. Prior to the existence of the %tensorboard magic, the standard way to achieve this was to proxy network traffic to the Colab VM using ngrok. A Colab example can be found here. These are the steps (the code snippets represent cells of type "code" in colab): Get TensorBoard running in the background. Inspired by this answer. LOG_DIR = '/tmp/log' get_ipython().system_raw( 'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &' .format(LOG_DIR) ) Download and unzip ngrok. Replace the link passed to wget with the correct download link for your OS. ! wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip ! unzip ngrok-stable-linux-amd64.zip Launch ngrok background process... get_ipython().system_raw('./ngrok http 6006 &') ...and retrieve public url. Source ! curl -s http://localho...

Basic 1d Convolution In Tensorflow

Answer : I am sorry to say that, but your first code was almost right. You just inverted x and phi in tf.nn.conv2d : g = tf.Graph() with g.as_default(): # data shape is "[batch, in_height, in_width, in_channels]", x = tf.Variable(np.array([0.0, 0.0, 0.0, 0.0, 1.0]).reshape(1, 1, 5, 1), name="x") # filter shape is "[filter_height, filter_width, in_channels, out_channels]" phi = tf.Variable(np.array([0.0, 0.5, 1.0]).reshape(1, 3, 1, 1), name="phi") conv = tf.nn.conv2d( x, phi, strides=[1, 1, 1, 1], padding="SAME", name="conv") Update: TensorFlow now supports 1D convolution since version r0.11, using tf.nn.conv1d . I previously made a guide to use them in the stackoverflow documentation (now extinct) that I'm pasting here: Guide to 1D convolution Consider a basic example with an input of length 10 , and dimension 16 . The batch size is 32 . We there...

Cannot Connect To X Server GOOGLE COLAB

Answer : An X server is a program in the X Window System that runs on local machines (i.e. the computers used directly by users) and handles all access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers. With that said Colab runs as a terminal instance in the server, if you are using GPU runtime, then the problem is not with X server accessing your Graphics card, neither with Input devices, generally this occurs when you try to parse some data that should be displayed as separate window on your desktop, commands like cv2.imshow() , there can be other similar functions that can cause this problem, if you have to use graphical ouput you might want to look into %matplotlib notebook and displaying the data in the interactable matplot plots. If this is not your issue, just post a link to your modified code and I might be able to help more. I had the same problem in Colab for a simple OpenCV program to track a tennis ball in ...