-
-
Save kiransair/a8ad25eae2ae10a06515f950e2acebe6 to your computer and use it in GitHub Desktop.
Tf_Forum_17056.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyNvQFd3nDYsHuXMfIwXJzep", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/kiransair/a8ad25eae2ae10a06515f950e2acebe6/tf_forum_17056.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"id": "_CVv7mkVIDcE" | |
}, | |
"outputs": [], | |
"source": [ | |
"import tensorflow as tf" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import json" | |
], | |
"metadata": { | |
"id": "cwzXvk48IFjF" | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"data = [[0.147856,0.002688,0.108568,0.983028],\n", | |
" [0.148294,0.002196,0.107716,0.983056],\n", | |
" [0.148497,0.003929,0.107291,0.983067],\n", | |
" [0.150672,0.00348,0.106285,0.982847]]" | |
], | |
"metadata": { | |
"id": "SsU9yGsOIMfY" | |
}, | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"file_path = './test.json'" | |
], | |
"metadata": { | |
"id": "pSLQBisRIPH5" | |
}, | |
"execution_count": 4, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"with open(file_path, 'w') as f:\n", | |
" json.dump(data, f)" | |
], | |
"metadata": { | |
"id": "IzWkMWjwIRYf" | |
}, | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"with open('/content/test.json', 'r') as f:\n", | |
" data = json.load(f)\n", | |
" " | |
], | |
"metadata": { | |
"id": "itP0FRIjIT4u" | |
}, | |
"execution_count": 6, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"dataset = tf.data.Dataset.from_tensor_slices(data)" | |
], | |
"metadata": { | |
"id": "_5AArPa9IZAx" | |
}, | |
"execution_count": 7, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "_INvbMJYIbzN" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment