This file contains hidden or 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
| class Vector | |
| attr_accessor :x, :y, :z | |
| def initialize(x, y, z) | |
| @x = x | |
| @y = y | |
| @z = z | |
| end | |
| def add(v) | |
| Vector.new(self.x+v.x, self.y+v.y, self.z+v.z) | |
| end |
This file contains hidden or 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
| node { | |
| name: "Const" | |
| op: "Const" | |
| attr { | |
| key: "dtype" | |
| value { | |
| type: DT_INT32 | |
| } | |
| } | |
| attr { |
This file contains hidden or 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
| module M | |
| def foo | |
| puts "deinfed?(foo) => #{defined?(foo).inspect}" | |
| puts "method(:foo) => #{method(:foo) rescue $!}" | |
| p self | |
| end | |
| end | |
| a = "str-a" | |
| a.extend(M) |
This file contains hidden or 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
| class A | |
| DefConst = lambda{|x| Const = x } | |
| def foo(x) | |
| DefConst.call(x) | |
| end | |
| end | |
| p(defined?(A::Const)) # => nil | |
| A.new.foo(42) |
This file contains hidden or 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
| # TFRecord のファイルを tf.dataset で読み込むパイプラインを組む | |
| # これは NG | |
| labels = ["a", "b", "c"] | |
| def input_fn(): | |
| def _parse_example(example): | |
| features = tf.parse_single_example(example, features=tf_features_dict) | |
| label_str = features.pop("label") | |
| return features, tf.contrib.lookup.index_table_from_tensor(labels).lookup(label_str) |
This file contains hidden or 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
| [ | |
| { | |
| "name": "document_sentiment", | |
| "type": "RECORD", | |
| "mode": "NULLABLE", | |
| "fields": [ | |
| { | |
| "name": "magnitude", | |
| "type": "FLOAT", | |
| "mode": "NULLABLE" |
This file contains hidden or 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
| [ | |
| { | |
| "name": "language", | |
| "type": "STRING", | |
| "mode": "NULLABLE" | |
| }, | |
| { | |
| "name": "entities", | |
| "type": "RECORD", | |
| "mode": "REPEATED", |
This file contains hidden or 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
| [ | |
| { | |
| "name": "language", | |
| "type": "STRING", | |
| "mode": "NULLABLE" | |
| }, | |
| { | |
| "name": "sentences", | |
| "type": "RECORD", | |
| "mode": "REPEATED", |
This file contains hidden or 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
| [ | |
| { | |
| "name": "results", | |
| "type": "RECORD", | |
| "mode": "REPEATED", | |
| "fields": [ | |
| { | |
| "name": "alternatives", | |
| "type": "RECORD", | |
| "mode": "REPEATED", |
This file contains hidden or 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
| [ | |
| { | |
| "name": "gcs_url", | |
| "type": "STRING", | |
| "mode": "NULLABLE" | |
| }, | |
| { | |
| "name": "timestamp", | |
| "type": "TIMESTAMP", | |
| "mode": "NULLABLE" |
NewerOlder